
obj/user/testpiperace2.debug:     file format elf32-i386


Disassembly of section .text:

00800020 <_start>:
// starts us running when we are initially loaded into a new environment.
.text
.globl _start
_start:
	// See if we were started with arguments on the stack
	cmpl $USTACKTOP, %esp
  800020:	81 fc 00 e0 bf ee    	cmp    $0xeebfe000,%esp
	jne args_exist
  800026:	75 04                	jne    80002c <args_exist>

	// If not, push dummy argc/argv arguments.
	// This happens when we are loaded by the kernel,
	// because the kernel does not know about passing arguments.
	pushl $0
  800028:	6a 00                	push   $0x0
	pushl $0
  80002a:	6a 00                	push   $0x0

0080002c <args_exist>:

args_exist:
	call libmain
  80002c:	e8 a3 01 00 00       	call   8001d4 <libmain>
1:	jmp 1b
  800031:	eb fe                	jmp    800031 <args_exist+0x5>

00800033 <umain>:

#include <inc/lib.h>

void
umain(int argc, char **argv)
{
  800033:	f3 0f 1e fb          	endbr32 
  800037:	55                   	push   %ebp
  800038:	89 e5                	mov    %esp,%ebp
  80003a:	57                   	push   %edi
  80003b:	56                   	push   %esi
  80003c:	53                   	push   %ebx
  80003d:	83 ec 28             	sub    $0x28,%esp
	int p[2], r, i;
	struct Fd *fd;
	const volatile struct Env *kid;

	cprintf("testing for pipeisclosed race...\n");
  800040:	68 40 24 80 00       	push   $0x802440
  800045:	e8 e3 02 00 00       	call   80032d <cprintf>
	if ((r = pipe(p)) < 0)
  80004a:	8d 45 e0             	lea    -0x20(%ebp),%eax
  80004d:	89 04 24             	mov    %eax,(%esp)
  800050:	e8 70 1c 00 00       	call   801cc5 <pipe>
  800055:	83 c4 10             	add    $0x10,%esp
  800058:	85 c0                	test   %eax,%eax
  80005a:	78 5b                	js     8000b7 <umain+0x84>
		panic("pipe: %e", r);
	if ((r = fork()) < 0)
  80005c:	e8 1e 10 00 00       	call   80107f <fork>
  800061:	89 c7                	mov    %eax,%edi
  800063:	85 c0                	test   %eax,%eax
  800065:	78 62                	js     8000c9 <umain+0x96>
		panic("fork: %e", r);
	if (r == 0) {
  800067:	74 72                	je     8000db <umain+0xa8>
	// pageref(p[0]) and gets 3, then it will return true when
	// it shouldn't.
	//
	// So either way, pipeisclosed is going give a wrong answer.
	//
	kid = &envs[ENVX(r)];
  800069:	89 fb                	mov    %edi,%ebx
  80006b:	81 e3 ff 03 00 00    	and    $0x3ff,%ebx
	while (kid->env_status == ENV_RUNNABLE)
  800071:	6b db 7c             	imul   $0x7c,%ebx,%ebx
  800074:	81 c3 00 00 c0 ee    	add    $0xeec00000,%ebx
  80007a:	8b 43 54             	mov    0x54(%ebx),%eax
  80007d:	83 f8 02             	cmp    $0x2,%eax
  800080:	0f 85 d1 00 00 00    	jne    800157 <umain+0x124>
		if (pipeisclosed(p[0]) != 0) {
  800086:	83 ec 0c             	sub    $0xc,%esp
  800089:	ff 75 e0             	pushl  -0x20(%ebp)
  80008c:	e8 82 1d 00 00       	call   801e13 <pipeisclosed>
  800091:	83 c4 10             	add    $0x10,%esp
  800094:	85 c0                	test   %eax,%eax
  800096:	74 e2                	je     80007a <umain+0x47>
			cprintf("\nRACE: pipe appears closed\n");
  800098:	83 ec 0c             	sub    $0xc,%esp
  80009b:	68 b9 24 80 00       	push   $0x8024b9
  8000a0:	e8 88 02 00 00       	call   80032d <cprintf>
			sys_env_destroy(r);
  8000a5:	89 3c 24             	mov    %edi,(%esp)
  8000a8:	e8 10 0c 00 00       	call   800cbd <sys_env_destroy>
			exit();
  8000ad:	e8 76 01 00 00       	call   800228 <exit>
  8000b2:	83 c4 10             	add    $0x10,%esp
  8000b5:	eb c3                	jmp    80007a <umain+0x47>
		panic("pipe: %e", r);
  8000b7:	50                   	push   %eax
  8000b8:	68 8e 24 80 00       	push   $0x80248e
  8000bd:	6a 0d                	push   $0xd
  8000bf:	68 97 24 80 00       	push   $0x802497
  8000c4:	e8 7d 01 00 00       	call   800246 <_panic>
		panic("fork: %e", r);
  8000c9:	50                   	push   %eax
  8000ca:	68 ac 24 80 00       	push   $0x8024ac
  8000cf:	6a 0f                	push   $0xf
  8000d1:	68 97 24 80 00       	push   $0x802497
  8000d6:	e8 6b 01 00 00       	call   800246 <_panic>
		close(p[1]);
  8000db:	83 ec 0c             	sub    $0xc,%esp
  8000de:	ff 75 e4             	pushl  -0x1c(%ebp)
  8000e1:	e8 72 13 00 00       	call   801458 <close>
  8000e6:	83 c4 10             	add    $0x10,%esp
		for (i = 0; i < 200; i++) {
  8000e9:	89 fb                	mov    %edi,%ebx
			if (i % 10 == 0)
  8000eb:	be 67 66 66 66       	mov    $0x66666667,%esi
  8000f0:	eb 42                	jmp    800134 <umain+0x101>
				cprintf("%d.", i);
  8000f2:	83 ec 08             	sub    $0x8,%esp
  8000f5:	53                   	push   %ebx
  8000f6:	68 b5 24 80 00       	push   $0x8024b5
  8000fb:	e8 2d 02 00 00       	call   80032d <cprintf>
  800100:	83 c4 10             	add    $0x10,%esp
			dup(p[0], 10);
  800103:	83 ec 08             	sub    $0x8,%esp
  800106:	6a 0a                	push   $0xa
  800108:	ff 75 e0             	pushl  -0x20(%ebp)
  80010b:	e8 a2 13 00 00       	call   8014b2 <dup>
			sys_yield();
  800110:	e8 10 0c 00 00       	call   800d25 <sys_yield>
			close(10);
  800115:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  80011c:	e8 37 13 00 00       	call   801458 <close>
			sys_yield();
  800121:	e8 ff 0b 00 00       	call   800d25 <sys_yield>
		for (i = 0; i < 200; i++) {
  800126:	83 c3 01             	add    $0x1,%ebx
  800129:	83 c4 10             	add    $0x10,%esp
  80012c:	81 fb c8 00 00 00    	cmp    $0xc8,%ebx
  800132:	74 19                	je     80014d <umain+0x11a>
			if (i % 10 == 0)
  800134:	89 d8                	mov    %ebx,%eax
  800136:	f7 ee                	imul   %esi
  800138:	c1 fa 02             	sar    $0x2,%edx
  80013b:	89 d8                	mov    %ebx,%eax
  80013d:	c1 f8 1f             	sar    $0x1f,%eax
  800140:	29 c2                	sub    %eax,%edx
  800142:	8d 04 92             	lea    (%edx,%edx,4),%eax
  800145:	01 c0                	add    %eax,%eax
  800147:	39 c3                	cmp    %eax,%ebx
  800149:	75 b8                	jne    800103 <umain+0xd0>
  80014b:	eb a5                	jmp    8000f2 <umain+0xbf>
		exit();
  80014d:	e8 d6 00 00 00       	call   800228 <exit>
  800152:	e9 12 ff ff ff       	jmp    800069 <umain+0x36>
		}
	cprintf("child done with loop\n");
  800157:	83 ec 0c             	sub    $0xc,%esp
  80015a:	68 d5 24 80 00       	push   $0x8024d5
  80015f:	e8 c9 01 00 00       	call   80032d <cprintf>
	if (pipeisclosed(p[0]))
  800164:	83 c4 04             	add    $0x4,%esp
  800167:	ff 75 e0             	pushl  -0x20(%ebp)
  80016a:	e8 a4 1c 00 00       	call   801e13 <pipeisclosed>
  80016f:	83 c4 10             	add    $0x10,%esp
  800172:	85 c0                	test   %eax,%eax
  800174:	75 38                	jne    8001ae <umain+0x17b>
		panic("somehow the other end of p[0] got closed!");
	if ((r = fd_lookup(p[0], &fd)) < 0)
  800176:	83 ec 08             	sub    $0x8,%esp
  800179:	8d 45 dc             	lea    -0x24(%ebp),%eax
  80017c:	50                   	push   %eax
  80017d:	ff 75 e0             	pushl  -0x20(%ebp)
  800180:	e8 9a 11 00 00       	call   80131f <fd_lookup>
  800185:	83 c4 10             	add    $0x10,%esp
  800188:	85 c0                	test   %eax,%eax
  80018a:	78 36                	js     8001c2 <umain+0x18f>
		panic("cannot look up p[0]: %e", r);
	(void) fd2data(fd);
  80018c:	83 ec 0c             	sub    $0xc,%esp
  80018f:	ff 75 dc             	pushl  -0x24(%ebp)
  800192:	e8 17 11 00 00       	call   8012ae <fd2data>
	cprintf("race didn't happen\n");
  800197:	c7 04 24 03 25 80 00 	movl   $0x802503,(%esp)
  80019e:	e8 8a 01 00 00       	call   80032d <cprintf>
}
  8001a3:	83 c4 10             	add    $0x10,%esp
  8001a6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8001a9:	5b                   	pop    %ebx
  8001aa:	5e                   	pop    %esi
  8001ab:	5f                   	pop    %edi
  8001ac:	5d                   	pop    %ebp
  8001ad:	c3                   	ret    
		panic("somehow the other end of p[0] got closed!");
  8001ae:	83 ec 04             	sub    $0x4,%esp
  8001b1:	68 64 24 80 00       	push   $0x802464
  8001b6:	6a 40                	push   $0x40
  8001b8:	68 97 24 80 00       	push   $0x802497
  8001bd:	e8 84 00 00 00       	call   800246 <_panic>
		panic("cannot look up p[0]: %e", r);
  8001c2:	50                   	push   %eax
  8001c3:	68 eb 24 80 00       	push   $0x8024eb
  8001c8:	6a 42                	push   $0x42
  8001ca:	68 97 24 80 00       	push   $0x802497
  8001cf:	e8 72 00 00 00       	call   800246 <_panic>

008001d4 <libmain>:
const volatile struct Env *thisenv;
const char *binaryname = "<unknown>";

void
libmain(int argc, char **argv)
{
  8001d4:	f3 0f 1e fb          	endbr32 
  8001d8:	55                   	push   %ebp
  8001d9:	89 e5                	mov    %esp,%ebp
  8001db:	56                   	push   %esi
  8001dc:	53                   	push   %ebx
  8001dd:	8b 5d 08             	mov    0x8(%ebp),%ebx
  8001e0:	8b 75 0c             	mov    0xc(%ebp),%esi
	;    //系统调用，我们已经在Exercise 7中实现了
	
	
	
	//屏幕上打印出来了字母，但后续报错了，有意思，让我看看问题出现在哪。
	thisenv=0;
  8001e3:	c7 05 04 40 80 00 00 	movl   $0x0,0x804004
  8001ea:	00 00 00 
	thisenv = &envs[ENVX(sys_getenvid())];      //获取Env结构指针
  8001ed:	e8 10 0b 00 00       	call   800d02 <sys_getenvid>
  8001f2:	25 ff 03 00 00       	and    $0x3ff,%eax
  8001f7:	6b c0 7c             	imul   $0x7c,%eax,%eax
  8001fa:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  8001ff:	a3 04 40 80 00       	mov    %eax,0x804004

	// save the name of the program so that panic() can use it
	if (argc > 0)
  800204:	85 db                	test   %ebx,%ebx
  800206:	7e 07                	jle    80020f <libmain+0x3b>
		binaryname = argv[0];
  800208:	8b 06                	mov    (%esi),%eax
  80020a:	a3 00 30 80 00       	mov    %eax,0x803000

	// call user main routine
	umain(argc, argv);
  80020f:	83 ec 08             	sub    $0x8,%esp
  800212:	56                   	push   %esi
  800213:	53                   	push   %ebx
  800214:	e8 1a fe ff ff       	call   800033 <umain>

	// exit gracefully
	exit();
  800219:	e8 0a 00 00 00       	call   800228 <exit>
}
  80021e:	83 c4 10             	add    $0x10,%esp
  800221:	8d 65 f8             	lea    -0x8(%ebp),%esp
  800224:	5b                   	pop    %ebx
  800225:	5e                   	pop    %esi
  800226:	5d                   	pop    %ebp
  800227:	c3                   	ret    

00800228 <exit>:

#include <inc/lib.h>

void
exit(void)
{
  800228:	f3 0f 1e fb          	endbr32 
  80022c:	55                   	push   %ebp
  80022d:	89 e5                	mov    %esp,%ebp
  80022f:	83 ec 08             	sub    $0x8,%esp
	close_all();
  800232:	e8 52 12 00 00       	call   801489 <close_all>
	sys_env_destroy(0);
  800237:	83 ec 0c             	sub    $0xc,%esp
  80023a:	6a 00                	push   $0x0
  80023c:	e8 7c 0a 00 00       	call   800cbd <sys_env_destroy>
}
  800241:	83 c4 10             	add    $0x10,%esp
  800244:	c9                   	leave  
  800245:	c3                   	ret    

00800246 <_panic>:
 * It prints "panic: <message>", then causes a breakpoint exception,
 * which causes JOS to enter the JOS kernel monitor.
 */
void
_panic(const char *file, int line, const char *fmt, ...)
{
  800246:	f3 0f 1e fb          	endbr32 
  80024a:	55                   	push   %ebp
  80024b:	89 e5                	mov    %esp,%ebp
  80024d:	56                   	push   %esi
  80024e:	53                   	push   %ebx
	va_list ap;

	va_start(ap, fmt);
  80024f:	8d 5d 14             	lea    0x14(%ebp),%ebx

	// Print the panic message
	cprintf("[%08x] user panic in %s at %s:%d: ",
  800252:	8b 35 00 30 80 00    	mov    0x803000,%esi
  800258:	e8 a5 0a 00 00       	call   800d02 <sys_getenvid>
  80025d:	83 ec 0c             	sub    $0xc,%esp
  800260:	ff 75 0c             	pushl  0xc(%ebp)
  800263:	ff 75 08             	pushl  0x8(%ebp)
  800266:	56                   	push   %esi
  800267:	50                   	push   %eax
  800268:	68 24 25 80 00       	push   $0x802524
  80026d:	e8 bb 00 00 00       	call   80032d <cprintf>
		sys_getenvid(), binaryname, file, line);
	vcprintf(fmt, ap);
  800272:	83 c4 18             	add    $0x18,%esp
  800275:	53                   	push   %ebx
  800276:	ff 75 10             	pushl  0x10(%ebp)
  800279:	e8 5a 00 00 00       	call   8002d8 <vcprintf>
	cprintf("\n");
  80027e:	c7 04 24 93 2a 80 00 	movl   $0x802a93,(%esp)
  800285:	e8 a3 00 00 00       	call   80032d <cprintf>
  80028a:	83 c4 10             	add    $0x10,%esp

	// Cause a breakpoint exception
	while (1)
		asm volatile("int3");
  80028d:	cc                   	int3   
  80028e:	eb fd                	jmp    80028d <_panic+0x47>

00800290 <putch>:
};


static void
putch(int ch, struct printbuf *b)
{
  800290:	f3 0f 1e fb          	endbr32 
  800294:	55                   	push   %ebp
  800295:	89 e5                	mov    %esp,%ebp
  800297:	53                   	push   %ebx
  800298:	83 ec 04             	sub    $0x4,%esp
  80029b:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	b->buf[b->idx++] = ch;
  80029e:	8b 13                	mov    (%ebx),%edx
  8002a0:	8d 42 01             	lea    0x1(%edx),%eax
  8002a3:	89 03                	mov    %eax,(%ebx)
  8002a5:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8002a8:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
	if (b->idx == 256-1) {
  8002ac:	3d ff 00 00 00       	cmp    $0xff,%eax
  8002b1:	74 09                	je     8002bc <putch+0x2c>
		sys_cputs(b->buf, b->idx);
		b->idx = 0;
	}
	b->cnt++;
  8002b3:	83 43 04 01          	addl   $0x1,0x4(%ebx)
}
  8002b7:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8002ba:	c9                   	leave  
  8002bb:	c3                   	ret    
		sys_cputs(b->buf, b->idx);
  8002bc:	83 ec 08             	sub    $0x8,%esp
  8002bf:	68 ff 00 00 00       	push   $0xff
  8002c4:	8d 43 08             	lea    0x8(%ebx),%eax
  8002c7:	50                   	push   %eax
  8002c8:	e8 ab 09 00 00       	call   800c78 <sys_cputs>
		b->idx = 0;
  8002cd:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8002d3:	83 c4 10             	add    $0x10,%esp
  8002d6:	eb db                	jmp    8002b3 <putch+0x23>

008002d8 <vcprintf>:

int
vcprintf(const char *fmt, va_list ap)
{
  8002d8:	f3 0f 1e fb          	endbr32 
  8002dc:	55                   	push   %ebp
  8002dd:	89 e5                	mov    %esp,%ebp
  8002df:	81 ec 18 01 00 00    	sub    $0x118,%esp
	struct printbuf b;

	b.idx = 0;
  8002e5:	c7 85 f0 fe ff ff 00 	movl   $0x0,-0x110(%ebp)
  8002ec:	00 00 00 
	b.cnt = 0;
  8002ef:	c7 85 f4 fe ff ff 00 	movl   $0x0,-0x10c(%ebp)
  8002f6:	00 00 00 
	vprintfmt((void*)putch, &b, fmt, ap);
  8002f9:	ff 75 0c             	pushl  0xc(%ebp)
  8002fc:	ff 75 08             	pushl  0x8(%ebp)
  8002ff:	8d 85 f0 fe ff ff    	lea    -0x110(%ebp),%eax
  800305:	50                   	push   %eax
  800306:	68 90 02 80 00       	push   $0x800290
  80030b:	e8 20 01 00 00       	call   800430 <vprintfmt>
	sys_cputs(b.buf, b.idx);
  800310:	83 c4 08             	add    $0x8,%esp
  800313:	ff b5 f0 fe ff ff    	pushl  -0x110(%ebp)
  800319:	8d 85 f8 fe ff ff    	lea    -0x108(%ebp),%eax
  80031f:	50                   	push   %eax
  800320:	e8 53 09 00 00       	call   800c78 <sys_cputs>

	return b.cnt;
}
  800325:	8b 85 f4 fe ff ff    	mov    -0x10c(%ebp),%eax
  80032b:	c9                   	leave  
  80032c:	c3                   	ret    

0080032d <cprintf>:

int
cprintf(const char *fmt, ...)
{
  80032d:	f3 0f 1e fb          	endbr32 
  800331:	55                   	push   %ebp
  800332:	89 e5                	mov    %esp,%ebp
  800334:	83 ec 10             	sub    $0x10,%esp
	va_list ap;
	int cnt;

	va_start(ap, fmt);
  800337:	8d 45 0c             	lea    0xc(%ebp),%eax
	cnt = vcprintf(fmt, ap);
  80033a:	50                   	push   %eax
  80033b:	ff 75 08             	pushl  0x8(%ebp)
  80033e:	e8 95 ff ff ff       	call   8002d8 <vcprintf>
	va_end(ap);

	return cnt;
}
  800343:	c9                   	leave  
  800344:	c3                   	ret    

00800345 <printnum>:
 * using specified putch function and associated pointer putdat.
 */
static void
printnum(void (*putch)(int, void*), void *putdat,
	 unsigned long long num, unsigned base, int width, int padc)
{
  800345:	55                   	push   %ebp
  800346:	89 e5                	mov    %esp,%ebp
  800348:	57                   	push   %edi
  800349:	56                   	push   %esi
  80034a:	53                   	push   %ebx
  80034b:	83 ec 1c             	sub    $0x1c,%esp
  80034e:	89 c7                	mov    %eax,%edi
  800350:	89 d6                	mov    %edx,%esi
  800352:	8b 45 08             	mov    0x8(%ebp),%eax
  800355:	8b 55 0c             	mov    0xc(%ebp),%edx
  800358:	89 d1                	mov    %edx,%ecx
  80035a:	89 c2                	mov    %eax,%edx
  80035c:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80035f:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  800362:	8b 45 10             	mov    0x10(%ebp),%eax
  800365:	8b 5d 14             	mov    0x14(%ebp),%ebx
	// first recursively print all preceding (more significant) digits
	if (num >= base) {
  800368:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80036b:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
  800372:	39 c2                	cmp    %eax,%edx
  800374:	1b 4d e4             	sbb    -0x1c(%ebp),%ecx
  800377:	72 3e                	jb     8003b7 <printnum+0x72>
		printnum(putch, putdat, num / base, base, width - 1, padc);
  800379:	83 ec 0c             	sub    $0xc,%esp
  80037c:	ff 75 18             	pushl  0x18(%ebp)
  80037f:	83 eb 01             	sub    $0x1,%ebx
  800382:	53                   	push   %ebx
  800383:	50                   	push   %eax
  800384:	83 ec 08             	sub    $0x8,%esp
  800387:	ff 75 e4             	pushl  -0x1c(%ebp)
  80038a:	ff 75 e0             	pushl  -0x20(%ebp)
  80038d:	ff 75 dc             	pushl  -0x24(%ebp)
  800390:	ff 75 d8             	pushl  -0x28(%ebp)
  800393:	e8 48 1e 00 00       	call   8021e0 <__udivdi3>
  800398:	83 c4 18             	add    $0x18,%esp
  80039b:	52                   	push   %edx
  80039c:	50                   	push   %eax
  80039d:	89 f2                	mov    %esi,%edx
  80039f:	89 f8                	mov    %edi,%eax
  8003a1:	e8 9f ff ff ff       	call   800345 <printnum>
  8003a6:	83 c4 20             	add    $0x20,%esp
  8003a9:	eb 13                	jmp    8003be <printnum+0x79>
	} else {
		// print any needed pad characters before first digit
		while (--width > 0)
			putch(padc, putdat);
  8003ab:	83 ec 08             	sub    $0x8,%esp
  8003ae:	56                   	push   %esi
  8003af:	ff 75 18             	pushl  0x18(%ebp)
  8003b2:	ff d7                	call   *%edi
  8003b4:	83 c4 10             	add    $0x10,%esp
		while (--width > 0)
  8003b7:	83 eb 01             	sub    $0x1,%ebx
  8003ba:	85 db                	test   %ebx,%ebx
  8003bc:	7f ed                	jg     8003ab <printnum+0x66>
	}

	// then print this (the least significant) digit
	putch("0123456789abcdef"[num % base], putdat);
  8003be:	83 ec 08             	sub    $0x8,%esp
  8003c1:	56                   	push   %esi
  8003c2:	83 ec 04             	sub    $0x4,%esp
  8003c5:	ff 75 e4             	pushl  -0x1c(%ebp)
  8003c8:	ff 75 e0             	pushl  -0x20(%ebp)
  8003cb:	ff 75 dc             	pushl  -0x24(%ebp)
  8003ce:	ff 75 d8             	pushl  -0x28(%ebp)
  8003d1:	e8 1a 1f 00 00       	call   8022f0 <__umoddi3>
  8003d6:	83 c4 14             	add    $0x14,%esp
  8003d9:	0f be 80 47 25 80 00 	movsbl 0x802547(%eax),%eax
  8003e0:	50                   	push   %eax
  8003e1:	ff d7                	call   *%edi
}
  8003e3:	83 c4 10             	add    $0x10,%esp
  8003e6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  8003e9:	5b                   	pop    %ebx
  8003ea:	5e                   	pop    %esi
  8003eb:	5f                   	pop    %edi
  8003ec:	5d                   	pop    %ebp
  8003ed:	c3                   	ret    

008003ee <sprintputch>:
	int cnt;
};

static void
sprintputch(int ch, struct sprintbuf *b)
{
  8003ee:	f3 0f 1e fb          	endbr32 
  8003f2:	55                   	push   %ebp
  8003f3:	89 e5                	mov    %esp,%ebp
  8003f5:	8b 45 0c             	mov    0xc(%ebp),%eax
	b->cnt++;
  8003f8:	83 40 08 01          	addl   $0x1,0x8(%eax)
	if (b->buf < b->ebuf)
  8003fc:	8b 10                	mov    (%eax),%edx
  8003fe:	3b 50 04             	cmp    0x4(%eax),%edx
  800401:	73 0a                	jae    80040d <sprintputch+0x1f>
		*b->buf++ = ch;
  800403:	8d 4a 01             	lea    0x1(%edx),%ecx
  800406:	89 08                	mov    %ecx,(%eax)
  800408:	8b 45 08             	mov    0x8(%ebp),%eax
  80040b:	88 02                	mov    %al,(%edx)
}
  80040d:	5d                   	pop    %ebp
  80040e:	c3                   	ret    

0080040f <printfmt>:
{
  80040f:	f3 0f 1e fb          	endbr32 
  800413:	55                   	push   %ebp
  800414:	89 e5                	mov    %esp,%ebp
  800416:	83 ec 08             	sub    $0x8,%esp
	va_start(ap, fmt);
  800419:	8d 45 14             	lea    0x14(%ebp),%eax
	vprintfmt(putch, putdat, fmt, ap);
  80041c:	50                   	push   %eax
  80041d:	ff 75 10             	pushl  0x10(%ebp)
  800420:	ff 75 0c             	pushl  0xc(%ebp)
  800423:	ff 75 08             	pushl  0x8(%ebp)
  800426:	e8 05 00 00 00       	call   800430 <vprintfmt>
}
  80042b:	83 c4 10             	add    $0x10,%esp
  80042e:	c9                   	leave  
  80042f:	c3                   	ret    

00800430 <vprintfmt>:
{
  800430:	f3 0f 1e fb          	endbr32 
  800434:	55                   	push   %ebp
  800435:	89 e5                	mov    %esp,%ebp
  800437:	57                   	push   %edi
  800438:	56                   	push   %esi
  800439:	53                   	push   %ebx
  80043a:	83 ec 3c             	sub    $0x3c,%esp
  80043d:	8b 75 08             	mov    0x8(%ebp),%esi
  800440:	8b 5d 0c             	mov    0xc(%ebp),%ebx
  800443:	8b 7d 10             	mov    0x10(%ebp),%edi
  800446:	e9 5d 03 00 00       	jmp    8007a8 <vprintfmt+0x378>
		padc = ' ';
  80044b:	c6 45 d3 20          	movb   $0x20,-0x2d(%ebp)
		altflag = 0;
  80044f:	c7 45 e0 00 00 00 00 	movl   $0x0,-0x20(%ebp)
		precision = -1;
  800456:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
		width = -1;
  80045d:	c7 45 d4 ff ff ff ff 	movl   $0xffffffff,-0x2c(%ebp)
		lflag = 0;
  800464:	b9 00 00 00 00       	mov    $0x0,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  800469:	8d 47 01             	lea    0x1(%edi),%eax
  80046c:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80046f:	0f b6 17             	movzbl (%edi),%edx
  800472:	8d 42 dd             	lea    -0x23(%edx),%eax
  800475:	3c 55                	cmp    $0x55,%al
  800477:	0f 87 ae 03 00 00    	ja     80082b <vprintfmt+0x3fb>
  80047d:	0f b6 c0             	movzbl %al,%eax
  800480:	3e ff 24 85 80 26 80 	notrack jmp *0x802680(,%eax,4)
  800487:	00 
  800488:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			padc = '-';
  80048b:	c6 45 d3 2d          	movb   $0x2d,-0x2d(%ebp)
  80048f:	eb d8                	jmp    800469 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800491:	8b 7d e4             	mov    -0x1c(%ebp),%edi
  800494:	c6 45 d3 30          	movb   $0x30,-0x2d(%ebp)
  800498:	eb cf                	jmp    800469 <vprintfmt+0x39>
  80049a:	0f b6 d2             	movzbl %dl,%edx
  80049d:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			for (precision = 0; ; ++fmt) {
  8004a0:	b8 00 00 00 00       	mov    $0x0,%eax
  8004a5:	89 4d e4             	mov    %ecx,-0x1c(%ebp)
				precision = precision * 10 + ch - '0';
  8004a8:	8d 04 80             	lea    (%eax,%eax,4),%eax
  8004ab:	8d 44 42 d0          	lea    -0x30(%edx,%eax,2),%eax
				ch = *fmt;
  8004af:	0f be 17             	movsbl (%edi),%edx
				if (ch < '0' || ch > '9')
  8004b2:	8d 4a d0             	lea    -0x30(%edx),%ecx
  8004b5:	83 f9 09             	cmp    $0x9,%ecx
  8004b8:	77 55                	ja     80050f <vprintfmt+0xdf>
			for (precision = 0; ; ++fmt) {
  8004ba:	83 c7 01             	add    $0x1,%edi
				precision = precision * 10 + ch - '0';
  8004bd:	eb e9                	jmp    8004a8 <vprintfmt+0x78>
			precision = va_arg(ap, int);
  8004bf:	8b 45 14             	mov    0x14(%ebp),%eax
  8004c2:	8b 00                	mov    (%eax),%eax
  8004c4:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8004c7:	8b 45 14             	mov    0x14(%ebp),%eax
  8004ca:	8d 40 04             	lea    0x4(%eax),%eax
  8004cd:	89 45 14             	mov    %eax,0x14(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8004d0:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			if (width < 0)
  8004d3:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8004d7:	79 90                	jns    800469 <vprintfmt+0x39>
				width = precision, precision = -1;
  8004d9:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8004dc:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8004df:	c7 45 d8 ff ff ff ff 	movl   $0xffffffff,-0x28(%ebp)
  8004e6:	eb 81                	jmp    800469 <vprintfmt+0x39>
  8004e8:	8b 45 d4             	mov    -0x2c(%ebp),%eax
  8004eb:	85 c0                	test   %eax,%eax
  8004ed:	ba 00 00 00 00       	mov    $0x0,%edx
  8004f2:	0f 49 d0             	cmovns %eax,%edx
  8004f5:	89 55 d4             	mov    %edx,-0x2c(%ebp)
		switch (ch = *(unsigned char *) fmt++) {
  8004f8:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  8004fb:	e9 69 ff ff ff       	jmp    800469 <vprintfmt+0x39>
		switch (ch = *(unsigned char *) fmt++) {
  800500:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			altflag = 1;
  800503:	c7 45 e0 01 00 00 00 	movl   $0x1,-0x20(%ebp)
			goto reswitch;
  80050a:	e9 5a ff ff ff       	jmp    800469 <vprintfmt+0x39>
  80050f:	8b 4d e4             	mov    -0x1c(%ebp),%ecx
  800512:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800515:	eb bc                	jmp    8004d3 <vprintfmt+0xa3>
			lflag++;
  800517:	83 c1 01             	add    $0x1,%ecx
		switch (ch = *(unsigned char *) fmt++) {
  80051a:	8b 7d e4             	mov    -0x1c(%ebp),%edi
			goto reswitch;
  80051d:	e9 47 ff ff ff       	jmp    800469 <vprintfmt+0x39>
			putch(va_arg(ap, int), putdat);
  800522:	8b 45 14             	mov    0x14(%ebp),%eax
  800525:	8d 78 04             	lea    0x4(%eax),%edi
  800528:	83 ec 08             	sub    $0x8,%esp
  80052b:	53                   	push   %ebx
  80052c:	ff 30                	pushl  (%eax)
  80052e:	ff d6                	call   *%esi
			break;
  800530:	83 c4 10             	add    $0x10,%esp
			putch(va_arg(ap, int), putdat);
  800533:	89 7d 14             	mov    %edi,0x14(%ebp)
			break;
  800536:	e9 6a 02 00 00       	jmp    8007a5 <vprintfmt+0x375>
			err = va_arg(ap, int);
  80053b:	8b 45 14             	mov    0x14(%ebp),%eax
  80053e:	8d 78 04             	lea    0x4(%eax),%edi
  800541:	8b 00                	mov    (%eax),%eax
  800543:	99                   	cltd   
  800544:	31 d0                	xor    %edx,%eax
  800546:	29 d0                	sub    %edx,%eax
			if (err >= MAXERROR || (p = error_string[err]) == NULL)
  800548:	83 f8 0f             	cmp    $0xf,%eax
  80054b:	7f 23                	jg     800570 <vprintfmt+0x140>
  80054d:	8b 14 85 e0 27 80 00 	mov    0x8027e0(,%eax,4),%edx
  800554:	85 d2                	test   %edx,%edx
  800556:	74 18                	je     800570 <vprintfmt+0x140>
				printfmt(putch, putdat, "%s", p);
  800558:	52                   	push   %edx
  800559:	68 61 2a 80 00       	push   $0x802a61
  80055e:	53                   	push   %ebx
  80055f:	56                   	push   %esi
  800560:	e8 aa fe ff ff       	call   80040f <printfmt>
  800565:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800568:	89 7d 14             	mov    %edi,0x14(%ebp)
  80056b:	e9 35 02 00 00       	jmp    8007a5 <vprintfmt+0x375>
				printfmt(putch, putdat, "error %d", err);
  800570:	50                   	push   %eax
  800571:	68 5f 25 80 00       	push   $0x80255f
  800576:	53                   	push   %ebx
  800577:	56                   	push   %esi
  800578:	e8 92 fe ff ff       	call   80040f <printfmt>
  80057d:	83 c4 10             	add    $0x10,%esp
			err = va_arg(ap, int);
  800580:	89 7d 14             	mov    %edi,0x14(%ebp)
				printfmt(putch, putdat, "error %d", err);
  800583:	e9 1d 02 00 00       	jmp    8007a5 <vprintfmt+0x375>
			if ((p = va_arg(ap, char *)) == NULL)
  800588:	8b 45 14             	mov    0x14(%ebp),%eax
  80058b:	83 c0 04             	add    $0x4,%eax
  80058e:	89 45 c8             	mov    %eax,-0x38(%ebp)
  800591:	8b 45 14             	mov    0x14(%ebp),%eax
  800594:	8b 10                	mov    (%eax),%edx
				p = "(null)";
  800596:	85 d2                	test   %edx,%edx
  800598:	b8 58 25 80 00       	mov    $0x802558,%eax
  80059d:	0f 45 c2             	cmovne %edx,%eax
  8005a0:	89 45 cc             	mov    %eax,-0x34(%ebp)
			if (width > 0 && padc != '-')
  8005a3:	83 7d d4 00          	cmpl   $0x0,-0x2c(%ebp)
  8005a7:	7e 06                	jle    8005af <vprintfmt+0x17f>
  8005a9:	80 7d d3 2d          	cmpb   $0x2d,-0x2d(%ebp)
  8005ad:	75 0d                	jne    8005bc <vprintfmt+0x18c>
				for (width -= strnlen(p, precision); width > 0; width--)
  8005af:	8b 45 cc             	mov    -0x34(%ebp),%eax
  8005b2:	89 c7                	mov    %eax,%edi
  8005b4:	03 45 d4             	add    -0x2c(%ebp),%eax
  8005b7:	89 45 d4             	mov    %eax,-0x2c(%ebp)
  8005ba:	eb 55                	jmp    800611 <vprintfmt+0x1e1>
  8005bc:	83 ec 08             	sub    $0x8,%esp
  8005bf:	ff 75 d8             	pushl  -0x28(%ebp)
  8005c2:	ff 75 cc             	pushl  -0x34(%ebp)
  8005c5:	e8 15 03 00 00       	call   8008df <strnlen>
  8005ca:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  8005cd:	29 c2                	sub    %eax,%edx
  8005cf:	89 55 c4             	mov    %edx,-0x3c(%ebp)
  8005d2:	83 c4 10             	add    $0x10,%esp
  8005d5:	89 d7                	mov    %edx,%edi
					putch(padc, putdat);
  8005d7:	0f be 45 d3          	movsbl -0x2d(%ebp),%eax
  8005db:	89 45 d4             	mov    %eax,-0x2c(%ebp)
				for (width -= strnlen(p, precision); width > 0; width--)
  8005de:	85 ff                	test   %edi,%edi
  8005e0:	7e 11                	jle    8005f3 <vprintfmt+0x1c3>
					putch(padc, putdat);
  8005e2:	83 ec 08             	sub    $0x8,%esp
  8005e5:	53                   	push   %ebx
  8005e6:	ff 75 d4             	pushl  -0x2c(%ebp)
  8005e9:	ff d6                	call   *%esi
				for (width -= strnlen(p, precision); width > 0; width--)
  8005eb:	83 ef 01             	sub    $0x1,%edi
  8005ee:	83 c4 10             	add    $0x10,%esp
  8005f1:	eb eb                	jmp    8005de <vprintfmt+0x1ae>
  8005f3:	8b 55 c4             	mov    -0x3c(%ebp),%edx
  8005f6:	85 d2                	test   %edx,%edx
  8005f8:	b8 00 00 00 00       	mov    $0x0,%eax
  8005fd:	0f 49 c2             	cmovns %edx,%eax
  800600:	29 c2                	sub    %eax,%edx
  800602:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800605:	eb a8                	jmp    8005af <vprintfmt+0x17f>
					putch(ch, putdat);
  800607:	83 ec 08             	sub    $0x8,%esp
  80060a:	53                   	push   %ebx
  80060b:	52                   	push   %edx
  80060c:	ff d6                	call   *%esi
  80060e:	83 c4 10             	add    $0x10,%esp
  800611:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  800614:	29 f9                	sub    %edi,%ecx
			for (; (ch = *p++) != '\0' && (precision < 0 || --precision >= 0); width--)
  800616:	83 c7 01             	add    $0x1,%edi
  800619:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  80061d:	0f be d0             	movsbl %al,%edx
  800620:	85 d2                	test   %edx,%edx
  800622:	74 4b                	je     80066f <vprintfmt+0x23f>
  800624:	83 7d d8 00          	cmpl   $0x0,-0x28(%ebp)
  800628:	78 06                	js     800630 <vprintfmt+0x200>
  80062a:	83 6d d8 01          	subl   $0x1,-0x28(%ebp)
  80062e:	78 1e                	js     80064e <vprintfmt+0x21e>
				if (altflag && (ch < ' ' || ch > '~'))
  800630:	83 7d e0 00          	cmpl   $0x0,-0x20(%ebp)
  800634:	74 d1                	je     800607 <vprintfmt+0x1d7>
  800636:	0f be c0             	movsbl %al,%eax
  800639:	83 e8 20             	sub    $0x20,%eax
  80063c:	83 f8 5e             	cmp    $0x5e,%eax
  80063f:	76 c6                	jbe    800607 <vprintfmt+0x1d7>
					putch('?', putdat);
  800641:	83 ec 08             	sub    $0x8,%esp
  800644:	53                   	push   %ebx
  800645:	6a 3f                	push   $0x3f
  800647:	ff d6                	call   *%esi
  800649:	83 c4 10             	add    $0x10,%esp
  80064c:	eb c3                	jmp    800611 <vprintfmt+0x1e1>
  80064e:	89 cf                	mov    %ecx,%edi
  800650:	eb 0e                	jmp    800660 <vprintfmt+0x230>
				putch(' ', putdat);
  800652:	83 ec 08             	sub    $0x8,%esp
  800655:	53                   	push   %ebx
  800656:	6a 20                	push   $0x20
  800658:	ff d6                	call   *%esi
			for (; width > 0; width--)
  80065a:	83 ef 01             	sub    $0x1,%edi
  80065d:	83 c4 10             	add    $0x10,%esp
  800660:	85 ff                	test   %edi,%edi
  800662:	7f ee                	jg     800652 <vprintfmt+0x222>
			if ((p = va_arg(ap, char *)) == NULL)
  800664:	8b 45 c8             	mov    -0x38(%ebp),%eax
  800667:	89 45 14             	mov    %eax,0x14(%ebp)
  80066a:	e9 36 01 00 00       	jmp    8007a5 <vprintfmt+0x375>
  80066f:	89 cf                	mov    %ecx,%edi
  800671:	eb ed                	jmp    800660 <vprintfmt+0x230>
	if (lflag >= 2)
  800673:	83 f9 01             	cmp    $0x1,%ecx
  800676:	7f 1f                	jg     800697 <vprintfmt+0x267>
	else if (lflag)
  800678:	85 c9                	test   %ecx,%ecx
  80067a:	74 67                	je     8006e3 <vprintfmt+0x2b3>
		return va_arg(*ap, long);
  80067c:	8b 45 14             	mov    0x14(%ebp),%eax
  80067f:	8b 00                	mov    (%eax),%eax
  800681:	89 45 d8             	mov    %eax,-0x28(%ebp)
  800684:	89 c1                	mov    %eax,%ecx
  800686:	c1 f9 1f             	sar    $0x1f,%ecx
  800689:	89 4d dc             	mov    %ecx,-0x24(%ebp)
  80068c:	8b 45 14             	mov    0x14(%ebp),%eax
  80068f:	8d 40 04             	lea    0x4(%eax),%eax
  800692:	89 45 14             	mov    %eax,0x14(%ebp)
  800695:	eb 17                	jmp    8006ae <vprintfmt+0x27e>
		return va_arg(*ap, long long);
  800697:	8b 45 14             	mov    0x14(%ebp),%eax
  80069a:	8b 50 04             	mov    0x4(%eax),%edx
  80069d:	8b 00                	mov    (%eax),%eax
  80069f:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006a2:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8006a5:	8b 45 14             	mov    0x14(%ebp),%eax
  8006a8:	8d 40 08             	lea    0x8(%eax),%eax
  8006ab:	89 45 14             	mov    %eax,0x14(%ebp)
			if ((long long) num < 0) {
  8006ae:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006b1:	8b 4d dc             	mov    -0x24(%ebp),%ecx
			base = 10;
  8006b4:	b8 0a 00 00 00       	mov    $0xa,%eax
			if ((long long) num < 0) {
  8006b9:	85 c9                	test   %ecx,%ecx
  8006bb:	0f 89 ca 00 00 00    	jns    80078b <vprintfmt+0x35b>
				putch('-', putdat);
  8006c1:	83 ec 08             	sub    $0x8,%esp
  8006c4:	53                   	push   %ebx
  8006c5:	6a 2d                	push   $0x2d
  8006c7:	ff d6                	call   *%esi
				num = -(long long) num;
  8006c9:	8b 55 d8             	mov    -0x28(%ebp),%edx
  8006cc:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8006cf:	f7 da                	neg    %edx
  8006d1:	83 d1 00             	adc    $0x0,%ecx
  8006d4:	f7 d9                	neg    %ecx
  8006d6:	83 c4 10             	add    $0x10,%esp
			base = 10;
  8006d9:	b8 0a 00 00 00       	mov    $0xa,%eax
  8006de:	e9 a8 00 00 00       	jmp    80078b <vprintfmt+0x35b>
		return va_arg(*ap, int);
  8006e3:	8b 45 14             	mov    0x14(%ebp),%eax
  8006e6:	8b 00                	mov    (%eax),%eax
  8006e8:	89 45 d8             	mov    %eax,-0x28(%ebp)
  8006eb:	99                   	cltd   
  8006ec:	89 55 dc             	mov    %edx,-0x24(%ebp)
  8006ef:	8b 45 14             	mov    0x14(%ebp),%eax
  8006f2:	8d 40 04             	lea    0x4(%eax),%eax
  8006f5:	89 45 14             	mov    %eax,0x14(%ebp)
  8006f8:	eb b4                	jmp    8006ae <vprintfmt+0x27e>
	if (lflag >= 2)
  8006fa:	83 f9 01             	cmp    $0x1,%ecx
  8006fd:	7f 1b                	jg     80071a <vprintfmt+0x2ea>
	else if (lflag)
  8006ff:	85 c9                	test   %ecx,%ecx
  800701:	74 2c                	je     80072f <vprintfmt+0x2ff>
		return va_arg(*ap, unsigned long);
  800703:	8b 45 14             	mov    0x14(%ebp),%eax
  800706:	8b 10                	mov    (%eax),%edx
  800708:	b9 00 00 00 00       	mov    $0x0,%ecx
  80070d:	8d 40 04             	lea    0x4(%eax),%eax
  800710:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800713:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long);
  800718:	eb 71                	jmp    80078b <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  80071a:	8b 45 14             	mov    0x14(%ebp),%eax
  80071d:	8b 10                	mov    (%eax),%edx
  80071f:	8b 48 04             	mov    0x4(%eax),%ecx
  800722:	8d 40 08             	lea    0x8(%eax),%eax
  800725:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  800728:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned long long);
  80072d:	eb 5c                	jmp    80078b <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  80072f:	8b 45 14             	mov    0x14(%ebp),%eax
  800732:	8b 10                	mov    (%eax),%edx
  800734:	b9 00 00 00 00       	mov    $0x0,%ecx
  800739:	8d 40 04             	lea    0x4(%eax),%eax
  80073c:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 10;
  80073f:	b8 0a 00 00 00       	mov    $0xa,%eax
		return va_arg(*ap, unsigned int);
  800744:	eb 45                	jmp    80078b <vprintfmt+0x35b>
			putch('X', putdat);
  800746:	83 ec 08             	sub    $0x8,%esp
  800749:	53                   	push   %ebx
  80074a:	6a 58                	push   $0x58
  80074c:	ff d6                	call   *%esi
			putch('X', putdat);
  80074e:	83 c4 08             	add    $0x8,%esp
  800751:	53                   	push   %ebx
  800752:	6a 58                	push   $0x58
  800754:	ff d6                	call   *%esi
			putch('X', putdat);
  800756:	83 c4 08             	add    $0x8,%esp
  800759:	53                   	push   %ebx
  80075a:	6a 58                	push   $0x58
  80075c:	ff d6                	call   *%esi
			break;
  80075e:	83 c4 10             	add    $0x10,%esp
  800761:	eb 42                	jmp    8007a5 <vprintfmt+0x375>
			putch('0', putdat);
  800763:	83 ec 08             	sub    $0x8,%esp
  800766:	53                   	push   %ebx
  800767:	6a 30                	push   $0x30
  800769:	ff d6                	call   *%esi
			putch('x', putdat);
  80076b:	83 c4 08             	add    $0x8,%esp
  80076e:	53                   	push   %ebx
  80076f:	6a 78                	push   $0x78
  800771:	ff d6                	call   *%esi
			num = (unsigned long long)
  800773:	8b 45 14             	mov    0x14(%ebp),%eax
  800776:	8b 10                	mov    (%eax),%edx
  800778:	b9 00 00 00 00       	mov    $0x0,%ecx
			goto number;
  80077d:	83 c4 10             	add    $0x10,%esp
				(uintptr_t) va_arg(ap, void *);
  800780:	8d 40 04             	lea    0x4(%eax),%eax
  800783:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800786:	b8 10 00 00 00       	mov    $0x10,%eax
			printnum(putch, putdat, num, base, width, padc);
  80078b:	83 ec 0c             	sub    $0xc,%esp
  80078e:	0f be 7d d3          	movsbl -0x2d(%ebp),%edi
  800792:	57                   	push   %edi
  800793:	ff 75 d4             	pushl  -0x2c(%ebp)
  800796:	50                   	push   %eax
  800797:	51                   	push   %ecx
  800798:	52                   	push   %edx
  800799:	89 da                	mov    %ebx,%edx
  80079b:	89 f0                	mov    %esi,%eax
  80079d:	e8 a3 fb ff ff       	call   800345 <printnum>
			break;
  8007a2:	83 c4 20             	add    $0x20,%esp
			if ((p = va_arg(ap, char *)) == NULL)
  8007a5:	8b 7d e4             	mov    -0x1c(%ebp),%edi
		while ((ch = *(unsigned char *) fmt++) != '%') {
  8007a8:	83 c7 01             	add    $0x1,%edi
  8007ab:	0f b6 47 ff          	movzbl -0x1(%edi),%eax
  8007af:	83 f8 25             	cmp    $0x25,%eax
  8007b2:	0f 84 93 fc ff ff    	je     80044b <vprintfmt+0x1b>
			if (ch == '\0')
  8007b8:	85 c0                	test   %eax,%eax
  8007ba:	0f 84 8b 00 00 00    	je     80084b <vprintfmt+0x41b>
			putch(ch, putdat);
  8007c0:	83 ec 08             	sub    $0x8,%esp
  8007c3:	53                   	push   %ebx
  8007c4:	50                   	push   %eax
  8007c5:	ff d6                	call   *%esi
  8007c7:	83 c4 10             	add    $0x10,%esp
  8007ca:	eb dc                	jmp    8007a8 <vprintfmt+0x378>
	if (lflag >= 2)
  8007cc:	83 f9 01             	cmp    $0x1,%ecx
  8007cf:	7f 1b                	jg     8007ec <vprintfmt+0x3bc>
	else if (lflag)
  8007d1:	85 c9                	test   %ecx,%ecx
  8007d3:	74 2c                	je     800801 <vprintfmt+0x3d1>
		return va_arg(*ap, unsigned long);
  8007d5:	8b 45 14             	mov    0x14(%ebp),%eax
  8007d8:	8b 10                	mov    (%eax),%edx
  8007da:	b9 00 00 00 00       	mov    $0x0,%ecx
  8007df:	8d 40 04             	lea    0x4(%eax),%eax
  8007e2:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007e5:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long);
  8007ea:	eb 9f                	jmp    80078b <vprintfmt+0x35b>
		return va_arg(*ap, unsigned long long);
  8007ec:	8b 45 14             	mov    0x14(%ebp),%eax
  8007ef:	8b 10                	mov    (%eax),%edx
  8007f1:	8b 48 04             	mov    0x4(%eax),%ecx
  8007f4:	8d 40 08             	lea    0x8(%eax),%eax
  8007f7:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  8007fa:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned long long);
  8007ff:	eb 8a                	jmp    80078b <vprintfmt+0x35b>
		return va_arg(*ap, unsigned int);
  800801:	8b 45 14             	mov    0x14(%ebp),%eax
  800804:	8b 10                	mov    (%eax),%edx
  800806:	b9 00 00 00 00       	mov    $0x0,%ecx
  80080b:	8d 40 04             	lea    0x4(%eax),%eax
  80080e:	89 45 14             	mov    %eax,0x14(%ebp)
			base = 16;
  800811:	b8 10 00 00 00       	mov    $0x10,%eax
		return va_arg(*ap, unsigned int);
  800816:	e9 70 ff ff ff       	jmp    80078b <vprintfmt+0x35b>
			putch(ch, putdat);
  80081b:	83 ec 08             	sub    $0x8,%esp
  80081e:	53                   	push   %ebx
  80081f:	6a 25                	push   $0x25
  800821:	ff d6                	call   *%esi
			break;
  800823:	83 c4 10             	add    $0x10,%esp
  800826:	e9 7a ff ff ff       	jmp    8007a5 <vprintfmt+0x375>
			putch('%', putdat);
  80082b:	83 ec 08             	sub    $0x8,%esp
  80082e:	53                   	push   %ebx
  80082f:	6a 25                	push   $0x25
  800831:	ff d6                	call   *%esi
			for (fmt--; fmt[-1] != '%'; fmt--)
  800833:	83 c4 10             	add    $0x10,%esp
  800836:	89 f8                	mov    %edi,%eax
  800838:	80 78 ff 25          	cmpb   $0x25,-0x1(%eax)
  80083c:	74 05                	je     800843 <vprintfmt+0x413>
  80083e:	83 e8 01             	sub    $0x1,%eax
  800841:	eb f5                	jmp    800838 <vprintfmt+0x408>
  800843:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  800846:	e9 5a ff ff ff       	jmp    8007a5 <vprintfmt+0x375>
}
  80084b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80084e:	5b                   	pop    %ebx
  80084f:	5e                   	pop    %esi
  800850:	5f                   	pop    %edi
  800851:	5d                   	pop    %ebp
  800852:	c3                   	ret    

00800853 <vsnprintf>:

int
vsnprintf(char *buf, int n, const char *fmt, va_list ap)
{
  800853:	f3 0f 1e fb          	endbr32 
  800857:	55                   	push   %ebp
  800858:	89 e5                	mov    %esp,%ebp
  80085a:	83 ec 18             	sub    $0x18,%esp
  80085d:	8b 45 08             	mov    0x8(%ebp),%eax
  800860:	8b 55 0c             	mov    0xc(%ebp),%edx
	struct sprintbuf b = {buf, buf+n-1, 0};
  800863:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800866:	8d 4c 10 ff          	lea    -0x1(%eax,%edx,1),%ecx
  80086a:	89 4d f0             	mov    %ecx,-0x10(%ebp)
  80086d:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)

	if (buf == NULL || n < 1)
  800874:	85 c0                	test   %eax,%eax
  800876:	74 26                	je     80089e <vsnprintf+0x4b>
  800878:	85 d2                	test   %edx,%edx
  80087a:	7e 22                	jle    80089e <vsnprintf+0x4b>
		return -E_INVAL;

	// print the string to the buffer
	vprintfmt((void*)sprintputch, &b, fmt, ap);
  80087c:	ff 75 14             	pushl  0x14(%ebp)
  80087f:	ff 75 10             	pushl  0x10(%ebp)
  800882:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800885:	50                   	push   %eax
  800886:	68 ee 03 80 00       	push   $0x8003ee
  80088b:	e8 a0 fb ff ff       	call   800430 <vprintfmt>

	// null terminate the buffer
	*b.buf = '\0';
  800890:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800893:	c6 00 00             	movb   $0x0,(%eax)

	return b.cnt;
  800896:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800899:	83 c4 10             	add    $0x10,%esp
}
  80089c:	c9                   	leave  
  80089d:	c3                   	ret    
		return -E_INVAL;
  80089e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8008a3:	eb f7                	jmp    80089c <vsnprintf+0x49>

008008a5 <snprintf>:

int
snprintf(char *buf, int n, const char *fmt, ...)
{
  8008a5:	f3 0f 1e fb          	endbr32 
  8008a9:	55                   	push   %ebp
  8008aa:	89 e5                	mov    %esp,%ebp
  8008ac:	83 ec 08             	sub    $0x8,%esp
	va_list ap;
	int rc;

	va_start(ap, fmt);
  8008af:	8d 45 14             	lea    0x14(%ebp),%eax
	rc = vsnprintf(buf, n, fmt, ap);
  8008b2:	50                   	push   %eax
  8008b3:	ff 75 10             	pushl  0x10(%ebp)
  8008b6:	ff 75 0c             	pushl  0xc(%ebp)
  8008b9:	ff 75 08             	pushl  0x8(%ebp)
  8008bc:	e8 92 ff ff ff       	call   800853 <vsnprintf>
	va_end(ap);

	return rc;
}
  8008c1:	c9                   	leave  
  8008c2:	c3                   	ret    

008008c3 <strlen>:
// Primespipe runs 3x faster this way.
#define ASM 1

int
strlen(const char *s)
{
  8008c3:	f3 0f 1e fb          	endbr32 
  8008c7:	55                   	push   %ebp
  8008c8:	89 e5                	mov    %esp,%ebp
  8008ca:	8b 55 08             	mov    0x8(%ebp),%edx
	int n;

	for (n = 0; *s != '\0'; s++)
  8008cd:	b8 00 00 00 00       	mov    $0x0,%eax
  8008d2:	80 3c 02 00          	cmpb   $0x0,(%edx,%eax,1)
  8008d6:	74 05                	je     8008dd <strlen+0x1a>
		n++;
  8008d8:	83 c0 01             	add    $0x1,%eax
  8008db:	eb f5                	jmp    8008d2 <strlen+0xf>
	return n;
}
  8008dd:	5d                   	pop    %ebp
  8008de:	c3                   	ret    

008008df <strnlen>:

int
strnlen(const char *s, size_t size)
{
  8008df:	f3 0f 1e fb          	endbr32 
  8008e3:	55                   	push   %ebp
  8008e4:	89 e5                	mov    %esp,%ebp
  8008e6:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8008e9:	8b 55 0c             	mov    0xc(%ebp),%edx
	int n;

	for (n = 0; size > 0 && *s != '\0'; s++, size--)
  8008ec:	b8 00 00 00 00       	mov    $0x0,%eax
  8008f1:	39 d0                	cmp    %edx,%eax
  8008f3:	74 0d                	je     800902 <strnlen+0x23>
  8008f5:	80 3c 01 00          	cmpb   $0x0,(%ecx,%eax,1)
  8008f9:	74 05                	je     800900 <strnlen+0x21>
		n++;
  8008fb:	83 c0 01             	add    $0x1,%eax
  8008fe:	eb f1                	jmp    8008f1 <strnlen+0x12>
  800900:	89 c2                	mov    %eax,%edx
	return n;
}
  800902:	89 d0                	mov    %edx,%eax
  800904:	5d                   	pop    %ebp
  800905:	c3                   	ret    

00800906 <strcpy>:

char *
strcpy(char *dst, const char *src)
{
  800906:	f3 0f 1e fb          	endbr32 
  80090a:	55                   	push   %ebp
  80090b:	89 e5                	mov    %esp,%ebp
  80090d:	53                   	push   %ebx
  80090e:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800911:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	char *ret;

	ret = dst;
	while ((*dst++ = *src++) != '\0')
  800914:	b8 00 00 00 00       	mov    $0x0,%eax
  800919:	0f b6 14 03          	movzbl (%ebx,%eax,1),%edx
  80091d:	88 14 01             	mov    %dl,(%ecx,%eax,1)
  800920:	83 c0 01             	add    $0x1,%eax
  800923:	84 d2                	test   %dl,%dl
  800925:	75 f2                	jne    800919 <strcpy+0x13>
		/* do nothing */;
	return ret;
}
  800927:	89 c8                	mov    %ecx,%eax
  800929:	5b                   	pop    %ebx
  80092a:	5d                   	pop    %ebp
  80092b:	c3                   	ret    

0080092c <strcat>:

char *
strcat(char *dst, const char *src)
{
  80092c:	f3 0f 1e fb          	endbr32 
  800930:	55                   	push   %ebp
  800931:	89 e5                	mov    %esp,%ebp
  800933:	53                   	push   %ebx
  800934:	83 ec 10             	sub    $0x10,%esp
  800937:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int len = strlen(dst);
  80093a:	53                   	push   %ebx
  80093b:	e8 83 ff ff ff       	call   8008c3 <strlen>
  800940:	83 c4 08             	add    $0x8,%esp
	strcpy(dst + len, src);
  800943:	ff 75 0c             	pushl  0xc(%ebp)
  800946:	01 d8                	add    %ebx,%eax
  800948:	50                   	push   %eax
  800949:	e8 b8 ff ff ff       	call   800906 <strcpy>
	return dst;
}
  80094e:	89 d8                	mov    %ebx,%eax
  800950:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  800953:	c9                   	leave  
  800954:	c3                   	ret    

00800955 <strncpy>:

char *
strncpy(char *dst, const char *src, size_t size) {
  800955:	f3 0f 1e fb          	endbr32 
  800959:	55                   	push   %ebp
  80095a:	89 e5                	mov    %esp,%ebp
  80095c:	56                   	push   %esi
  80095d:	53                   	push   %ebx
  80095e:	8b 75 08             	mov    0x8(%ebp),%esi
  800961:	8b 55 0c             	mov    0xc(%ebp),%edx
  800964:	89 f3                	mov    %esi,%ebx
  800966:	03 5d 10             	add    0x10(%ebp),%ebx
	size_t i;
	char *ret;

	ret = dst;
	for (i = 0; i < size; i++) {
  800969:	89 f0                	mov    %esi,%eax
  80096b:	39 d8                	cmp    %ebx,%eax
  80096d:	74 11                	je     800980 <strncpy+0x2b>
		*dst++ = *src;
  80096f:	83 c0 01             	add    $0x1,%eax
  800972:	0f b6 0a             	movzbl (%edx),%ecx
  800975:	88 48 ff             	mov    %cl,-0x1(%eax)
		// If strlen(src) < size, null-pad 'dst' out to 'size' chars
		if (*src != '\0')
			src++;
  800978:	80 f9 01             	cmp    $0x1,%cl
  80097b:	83 da ff             	sbb    $0xffffffff,%edx
  80097e:	eb eb                	jmp    80096b <strncpy+0x16>
	}
	return ret;
}
  800980:	89 f0                	mov    %esi,%eax
  800982:	5b                   	pop    %ebx
  800983:	5e                   	pop    %esi
  800984:	5d                   	pop    %ebp
  800985:	c3                   	ret    

00800986 <strlcpy>:

size_t
strlcpy(char *dst, const char *src, size_t size)
{
  800986:	f3 0f 1e fb          	endbr32 
  80098a:	55                   	push   %ebp
  80098b:	89 e5                	mov    %esp,%ebp
  80098d:	56                   	push   %esi
  80098e:	53                   	push   %ebx
  80098f:	8b 75 08             	mov    0x8(%ebp),%esi
  800992:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800995:	8b 55 10             	mov    0x10(%ebp),%edx
  800998:	89 f0                	mov    %esi,%eax
	char *dst_in;

	dst_in = dst;
	if (size > 0) {
  80099a:	85 d2                	test   %edx,%edx
  80099c:	74 21                	je     8009bf <strlcpy+0x39>
  80099e:	8d 44 16 ff          	lea    -0x1(%esi,%edx,1),%eax
  8009a2:	89 f2                	mov    %esi,%edx
		while (--size > 0 && *src != '\0')
  8009a4:	39 c2                	cmp    %eax,%edx
  8009a6:	74 14                	je     8009bc <strlcpy+0x36>
  8009a8:	0f b6 19             	movzbl (%ecx),%ebx
  8009ab:	84 db                	test   %bl,%bl
  8009ad:	74 0b                	je     8009ba <strlcpy+0x34>
			*dst++ = *src++;
  8009af:	83 c1 01             	add    $0x1,%ecx
  8009b2:	83 c2 01             	add    $0x1,%edx
  8009b5:	88 5a ff             	mov    %bl,-0x1(%edx)
  8009b8:	eb ea                	jmp    8009a4 <strlcpy+0x1e>
  8009ba:	89 d0                	mov    %edx,%eax
		*dst = '\0';
  8009bc:	c6 00 00             	movb   $0x0,(%eax)
	}
	return dst - dst_in;
  8009bf:	29 f0                	sub    %esi,%eax
}
  8009c1:	5b                   	pop    %ebx
  8009c2:	5e                   	pop    %esi
  8009c3:	5d                   	pop    %ebp
  8009c4:	c3                   	ret    

008009c5 <strcmp>:

int
strcmp(const char *p, const char *q)
{
  8009c5:	f3 0f 1e fb          	endbr32 
  8009c9:	55                   	push   %ebp
  8009ca:	89 e5                	mov    %esp,%ebp
  8009cc:	8b 4d 08             	mov    0x8(%ebp),%ecx
  8009cf:	8b 55 0c             	mov    0xc(%ebp),%edx
	while (*p && *p == *q)
  8009d2:	0f b6 01             	movzbl (%ecx),%eax
  8009d5:	84 c0                	test   %al,%al
  8009d7:	74 0c                	je     8009e5 <strcmp+0x20>
  8009d9:	3a 02                	cmp    (%edx),%al
  8009db:	75 08                	jne    8009e5 <strcmp+0x20>
		p++, q++;
  8009dd:	83 c1 01             	add    $0x1,%ecx
  8009e0:	83 c2 01             	add    $0x1,%edx
  8009e3:	eb ed                	jmp    8009d2 <strcmp+0xd>
	return (int) ((unsigned char) *p - (unsigned char) *q);
  8009e5:	0f b6 c0             	movzbl %al,%eax
  8009e8:	0f b6 12             	movzbl (%edx),%edx
  8009eb:	29 d0                	sub    %edx,%eax
}
  8009ed:	5d                   	pop    %ebp
  8009ee:	c3                   	ret    

008009ef <strncmp>:

int
strncmp(const char *p, const char *q, size_t n)
{
  8009ef:	f3 0f 1e fb          	endbr32 
  8009f3:	55                   	push   %ebp
  8009f4:	89 e5                	mov    %esp,%ebp
  8009f6:	53                   	push   %ebx
  8009f7:	8b 45 08             	mov    0x8(%ebp),%eax
  8009fa:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009fd:	89 c3                	mov    %eax,%ebx
  8009ff:	03 5d 10             	add    0x10(%ebp),%ebx
	while (n > 0 && *p && *p == *q)
  800a02:	eb 06                	jmp    800a0a <strncmp+0x1b>
		n--, p++, q++;
  800a04:	83 c0 01             	add    $0x1,%eax
  800a07:	83 c2 01             	add    $0x1,%edx
	while (n > 0 && *p && *p == *q)
  800a0a:	39 d8                	cmp    %ebx,%eax
  800a0c:	74 16                	je     800a24 <strncmp+0x35>
  800a0e:	0f b6 08             	movzbl (%eax),%ecx
  800a11:	84 c9                	test   %cl,%cl
  800a13:	74 04                	je     800a19 <strncmp+0x2a>
  800a15:	3a 0a                	cmp    (%edx),%cl
  800a17:	74 eb                	je     800a04 <strncmp+0x15>
	if (n == 0)
		return 0;
	else
		return (int) ((unsigned char) *p - (unsigned char) *q);
  800a19:	0f b6 00             	movzbl (%eax),%eax
  800a1c:	0f b6 12             	movzbl (%edx),%edx
  800a1f:	29 d0                	sub    %edx,%eax
}
  800a21:	5b                   	pop    %ebx
  800a22:	5d                   	pop    %ebp
  800a23:	c3                   	ret    
		return 0;
  800a24:	b8 00 00 00 00       	mov    $0x0,%eax
  800a29:	eb f6                	jmp    800a21 <strncmp+0x32>

00800a2b <strchr>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a null pointer if the string has no 'c'.
char *
strchr(const char *s, char c)
{
  800a2b:	f3 0f 1e fb          	endbr32 
  800a2f:	55                   	push   %ebp
  800a30:	89 e5                	mov    %esp,%ebp
  800a32:	8b 45 08             	mov    0x8(%ebp),%eax
  800a35:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a39:	0f b6 10             	movzbl (%eax),%edx
  800a3c:	84 d2                	test   %dl,%dl
  800a3e:	74 09                	je     800a49 <strchr+0x1e>
		if (*s == c)
  800a40:	38 ca                	cmp    %cl,%dl
  800a42:	74 0a                	je     800a4e <strchr+0x23>
	for (; *s; s++)
  800a44:	83 c0 01             	add    $0x1,%eax
  800a47:	eb f0                	jmp    800a39 <strchr+0xe>
			return (char *) s;
	return 0;
  800a49:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800a4e:	5d                   	pop    %ebp
  800a4f:	c3                   	ret    

00800a50 <strfind>:

// Return a pointer to the first occurrence of 'c' in 's',
// or a pointer to the string-ending null character if the string has no 'c'.
char *
strfind(const char *s, char c)
{
  800a50:	f3 0f 1e fb          	endbr32 
  800a54:	55                   	push   %ebp
  800a55:	89 e5                	mov    %esp,%ebp
  800a57:	8b 45 08             	mov    0x8(%ebp),%eax
  800a5a:	0f b6 4d 0c          	movzbl 0xc(%ebp),%ecx
	for (; *s; s++)
  800a5e:	0f b6 10             	movzbl (%eax),%edx
		if (*s == c)
  800a61:	38 ca                	cmp    %cl,%dl
  800a63:	74 09                	je     800a6e <strfind+0x1e>
  800a65:	84 d2                	test   %dl,%dl
  800a67:	74 05                	je     800a6e <strfind+0x1e>
	for (; *s; s++)
  800a69:	83 c0 01             	add    $0x1,%eax
  800a6c:	eb f0                	jmp    800a5e <strfind+0xe>
			break;
	return (char *) s;
}
  800a6e:	5d                   	pop    %ebp
  800a6f:	c3                   	ret    

00800a70 <memset>:

#if ASM
void *
memset(void *v, int c, size_t n)
{
  800a70:	f3 0f 1e fb          	endbr32 
  800a74:	55                   	push   %ebp
  800a75:	89 e5                	mov    %esp,%ebp
  800a77:	57                   	push   %edi
  800a78:	56                   	push   %esi
  800a79:	53                   	push   %ebx
  800a7a:	8b 7d 08             	mov    0x8(%ebp),%edi
  800a7d:	8b 4d 10             	mov    0x10(%ebp),%ecx
	char *p;

	if (n == 0)
  800a80:	85 c9                	test   %ecx,%ecx
  800a82:	74 31                	je     800ab5 <memset+0x45>
		return v;
	if ((int)v%4 == 0 && n%4 == 0) {
  800a84:	89 f8                	mov    %edi,%eax
  800a86:	09 c8                	or     %ecx,%eax
  800a88:	a8 03                	test   $0x3,%al
  800a8a:	75 23                	jne    800aaf <memset+0x3f>
		c &= 0xFF;
  800a8c:	0f b6 55 0c          	movzbl 0xc(%ebp),%edx
		c = (c<<24)|(c<<16)|(c<<8)|c;
  800a90:	89 d3                	mov    %edx,%ebx
  800a92:	c1 e3 08             	shl    $0x8,%ebx
  800a95:	89 d0                	mov    %edx,%eax
  800a97:	c1 e0 18             	shl    $0x18,%eax
  800a9a:	89 d6                	mov    %edx,%esi
  800a9c:	c1 e6 10             	shl    $0x10,%esi
  800a9f:	09 f0                	or     %esi,%eax
  800aa1:	09 c2                	or     %eax,%edx
  800aa3:	09 da                	or     %ebx,%edx
		asm volatile("cld; rep stosl\n"
			:: "D" (v), "a" (c), "c" (n/4)
  800aa5:	c1 e9 02             	shr    $0x2,%ecx
		asm volatile("cld; rep stosl\n"
  800aa8:	89 d0                	mov    %edx,%eax
  800aaa:	fc                   	cld    
  800aab:	f3 ab                	rep stos %eax,%es:(%edi)
  800aad:	eb 06                	jmp    800ab5 <memset+0x45>
			: "cc", "memory");
	} else
		asm volatile("cld; rep stosb\n"
  800aaf:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ab2:	fc                   	cld    
  800ab3:	f3 aa                	rep stos %al,%es:(%edi)
			:: "D" (v), "a" (c), "c" (n)
			: "cc", "memory");
	return v;
}
  800ab5:	89 f8                	mov    %edi,%eax
  800ab7:	5b                   	pop    %ebx
  800ab8:	5e                   	pop    %esi
  800ab9:	5f                   	pop    %edi
  800aba:	5d                   	pop    %ebp
  800abb:	c3                   	ret    

00800abc <memmove>:

void *
memmove(void *dst, const void *src, size_t n)
{
  800abc:	f3 0f 1e fb          	endbr32 
  800ac0:	55                   	push   %ebp
  800ac1:	89 e5                	mov    %esp,%ebp
  800ac3:	57                   	push   %edi
  800ac4:	56                   	push   %esi
  800ac5:	8b 45 08             	mov    0x8(%ebp),%eax
  800ac8:	8b 75 0c             	mov    0xc(%ebp),%esi
  800acb:	8b 4d 10             	mov    0x10(%ebp),%ecx
	const char *s;
	char *d;

	s = src;
	d = dst;
	if (s < d && s + n > d) {
  800ace:	39 c6                	cmp    %eax,%esi
  800ad0:	73 32                	jae    800b04 <memmove+0x48>
  800ad2:	8d 14 0e             	lea    (%esi,%ecx,1),%edx
  800ad5:	39 c2                	cmp    %eax,%edx
  800ad7:	76 2b                	jbe    800b04 <memmove+0x48>
		s += n;
		d += n;
  800ad9:	8d 3c 08             	lea    (%eax,%ecx,1),%edi
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800adc:	89 fe                	mov    %edi,%esi
  800ade:	09 ce                	or     %ecx,%esi
  800ae0:	09 d6                	or     %edx,%esi
  800ae2:	f7 c6 03 00 00 00    	test   $0x3,%esi
  800ae8:	75 0e                	jne    800af8 <memmove+0x3c>
			asm volatile("std; rep movsl\n"
				:: "D" (d-4), "S" (s-4), "c" (n/4) : "cc", "memory");
  800aea:	83 ef 04             	sub    $0x4,%edi
  800aed:	8d 72 fc             	lea    -0x4(%edx),%esi
  800af0:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("std; rep movsl\n"
  800af3:	fd                   	std    
  800af4:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800af6:	eb 09                	jmp    800b01 <memmove+0x45>
		else
			asm volatile("std; rep movsb\n"
				:: "D" (d-1), "S" (s-1), "c" (n) : "cc", "memory");
  800af8:	83 ef 01             	sub    $0x1,%edi
  800afb:	8d 72 ff             	lea    -0x1(%edx),%esi
			asm volatile("std; rep movsb\n"
  800afe:	fd                   	std    
  800aff:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
		// Some versions of GCC rely on DF being clear
		asm volatile("cld" ::: "cc");
  800b01:	fc                   	cld    
  800b02:	eb 1a                	jmp    800b1e <memmove+0x62>
	} else {
		if ((int)s%4 == 0 && (int)d%4 == 0 && n%4 == 0)
  800b04:	89 c2                	mov    %eax,%edx
  800b06:	09 ca                	or     %ecx,%edx
  800b08:	09 f2                	or     %esi,%edx
  800b0a:	f6 c2 03             	test   $0x3,%dl
  800b0d:	75 0a                	jne    800b19 <memmove+0x5d>
			asm volatile("cld; rep movsl\n"
				:: "D" (d), "S" (s), "c" (n/4) : "cc", "memory");
  800b0f:	c1 e9 02             	shr    $0x2,%ecx
			asm volatile("cld; rep movsl\n"
  800b12:	89 c7                	mov    %eax,%edi
  800b14:	fc                   	cld    
  800b15:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800b17:	eb 05                	jmp    800b1e <memmove+0x62>
		else
			asm volatile("cld; rep movsb\n"
  800b19:	89 c7                	mov    %eax,%edi
  800b1b:	fc                   	cld    
  800b1c:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
				:: "D" (d), "S" (s), "c" (n) : "cc", "memory");
	}
	return dst;
}
  800b1e:	5e                   	pop    %esi
  800b1f:	5f                   	pop    %edi
  800b20:	5d                   	pop    %ebp
  800b21:	c3                   	ret    

00800b22 <memcpy>:
}
#endif

void *
memcpy(void *dst, const void *src, size_t n)
{
  800b22:	f3 0f 1e fb          	endbr32 
  800b26:	55                   	push   %ebp
  800b27:	89 e5                	mov    %esp,%ebp
  800b29:	83 ec 0c             	sub    $0xc,%esp
	return memmove(dst, src, n);
  800b2c:	ff 75 10             	pushl  0x10(%ebp)
  800b2f:	ff 75 0c             	pushl  0xc(%ebp)
  800b32:	ff 75 08             	pushl  0x8(%ebp)
  800b35:	e8 82 ff ff ff       	call   800abc <memmove>
}
  800b3a:	c9                   	leave  
  800b3b:	c3                   	ret    

00800b3c <memcmp>:

int
memcmp(const void *v1, const void *v2, size_t n)
{
  800b3c:	f3 0f 1e fb          	endbr32 
  800b40:	55                   	push   %ebp
  800b41:	89 e5                	mov    %esp,%ebp
  800b43:	56                   	push   %esi
  800b44:	53                   	push   %ebx
  800b45:	8b 45 08             	mov    0x8(%ebp),%eax
  800b48:	8b 55 0c             	mov    0xc(%ebp),%edx
  800b4b:	89 c6                	mov    %eax,%esi
  800b4d:	03 75 10             	add    0x10(%ebp),%esi
	const uint8_t *s1 = (const uint8_t *) v1;
	const uint8_t *s2 = (const uint8_t *) v2;

	while (n-- > 0) {
  800b50:	39 f0                	cmp    %esi,%eax
  800b52:	74 1c                	je     800b70 <memcmp+0x34>
		if (*s1 != *s2)
  800b54:	0f b6 08             	movzbl (%eax),%ecx
  800b57:	0f b6 1a             	movzbl (%edx),%ebx
  800b5a:	38 d9                	cmp    %bl,%cl
  800b5c:	75 08                	jne    800b66 <memcmp+0x2a>
			return (int) *s1 - (int) *s2;
		s1++, s2++;
  800b5e:	83 c0 01             	add    $0x1,%eax
  800b61:	83 c2 01             	add    $0x1,%edx
  800b64:	eb ea                	jmp    800b50 <memcmp+0x14>
			return (int) *s1 - (int) *s2;
  800b66:	0f b6 c1             	movzbl %cl,%eax
  800b69:	0f b6 db             	movzbl %bl,%ebx
  800b6c:	29 d8                	sub    %ebx,%eax
  800b6e:	eb 05                	jmp    800b75 <memcmp+0x39>
	}

	return 0;
  800b70:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800b75:	5b                   	pop    %ebx
  800b76:	5e                   	pop    %esi
  800b77:	5d                   	pop    %ebp
  800b78:	c3                   	ret    

00800b79 <memfind>:

void *
memfind(const void *s, int c, size_t n)
{
  800b79:	f3 0f 1e fb          	endbr32 
  800b7d:	55                   	push   %ebp
  800b7e:	89 e5                	mov    %esp,%ebp
  800b80:	8b 45 08             	mov    0x8(%ebp),%eax
  800b83:	8b 4d 0c             	mov    0xc(%ebp),%ecx
	const void *ends = (const char *) s + n;
  800b86:	89 c2                	mov    %eax,%edx
  800b88:	03 55 10             	add    0x10(%ebp),%edx
	for (; s < ends; s++)
  800b8b:	39 d0                	cmp    %edx,%eax
  800b8d:	73 09                	jae    800b98 <memfind+0x1f>
		if (*(const unsigned char *) s == (unsigned char) c)
  800b8f:	38 08                	cmp    %cl,(%eax)
  800b91:	74 05                	je     800b98 <memfind+0x1f>
	for (; s < ends; s++)
  800b93:	83 c0 01             	add    $0x1,%eax
  800b96:	eb f3                	jmp    800b8b <memfind+0x12>
			break;
	return (void *) s;
}
  800b98:	5d                   	pop    %ebp
  800b99:	c3                   	ret    

00800b9a <strtol>:

long
strtol(const char *s, char **endptr, int base)
{
  800b9a:	f3 0f 1e fb          	endbr32 
  800b9e:	55                   	push   %ebp
  800b9f:	89 e5                	mov    %esp,%ebp
  800ba1:	57                   	push   %edi
  800ba2:	56                   	push   %esi
  800ba3:	53                   	push   %ebx
  800ba4:	8b 4d 08             	mov    0x8(%ebp),%ecx
  800ba7:	8b 5d 10             	mov    0x10(%ebp),%ebx
	int neg = 0;
	long val = 0;

	// gobble initial whitespace
	while (*s == ' ' || *s == '\t')
  800baa:	eb 03                	jmp    800baf <strtol+0x15>
		s++;
  800bac:	83 c1 01             	add    $0x1,%ecx
	while (*s == ' ' || *s == '\t')
  800baf:	0f b6 01             	movzbl (%ecx),%eax
  800bb2:	3c 20                	cmp    $0x20,%al
  800bb4:	74 f6                	je     800bac <strtol+0x12>
  800bb6:	3c 09                	cmp    $0x9,%al
  800bb8:	74 f2                	je     800bac <strtol+0x12>

	// plus/minus sign
	if (*s == '+')
  800bba:	3c 2b                	cmp    $0x2b,%al
  800bbc:	74 2a                	je     800be8 <strtol+0x4e>
	int neg = 0;
  800bbe:	bf 00 00 00 00       	mov    $0x0,%edi
		s++;
	else if (*s == '-')
  800bc3:	3c 2d                	cmp    $0x2d,%al
  800bc5:	74 2b                	je     800bf2 <strtol+0x58>
		s++, neg = 1;

	// hex or octal base prefix
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800bc7:	f7 c3 ef ff ff ff    	test   $0xffffffef,%ebx
  800bcd:	75 0f                	jne    800bde <strtol+0x44>
  800bcf:	80 39 30             	cmpb   $0x30,(%ecx)
  800bd2:	74 28                	je     800bfc <strtol+0x62>
		s += 2, base = 16;
	else if (base == 0 && s[0] == '0')
		s++, base = 8;
	else if (base == 0)
		base = 10;
  800bd4:	85 db                	test   %ebx,%ebx
  800bd6:	b8 0a 00 00 00       	mov    $0xa,%eax
  800bdb:	0f 44 d8             	cmove  %eax,%ebx
  800bde:	b8 00 00 00 00       	mov    $0x0,%eax
  800be3:	89 5d 10             	mov    %ebx,0x10(%ebp)
  800be6:	eb 46                	jmp    800c2e <strtol+0x94>
		s++;
  800be8:	83 c1 01             	add    $0x1,%ecx
	int neg = 0;
  800beb:	bf 00 00 00 00       	mov    $0x0,%edi
  800bf0:	eb d5                	jmp    800bc7 <strtol+0x2d>
		s++, neg = 1;
  800bf2:	83 c1 01             	add    $0x1,%ecx
  800bf5:	bf 01 00 00 00       	mov    $0x1,%edi
  800bfa:	eb cb                	jmp    800bc7 <strtol+0x2d>
	if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x'))
  800bfc:	80 79 01 78          	cmpb   $0x78,0x1(%ecx)
  800c00:	74 0e                	je     800c10 <strtol+0x76>
	else if (base == 0 && s[0] == '0')
  800c02:	85 db                	test   %ebx,%ebx
  800c04:	75 d8                	jne    800bde <strtol+0x44>
		s++, base = 8;
  800c06:	83 c1 01             	add    $0x1,%ecx
  800c09:	bb 08 00 00 00       	mov    $0x8,%ebx
  800c0e:	eb ce                	jmp    800bde <strtol+0x44>
		s += 2, base = 16;
  800c10:	83 c1 02             	add    $0x2,%ecx
  800c13:	bb 10 00 00 00       	mov    $0x10,%ebx
  800c18:	eb c4                	jmp    800bde <strtol+0x44>
	// digits
	while (1) {
		int dig;

		if (*s >= '0' && *s <= '9')
			dig = *s - '0';
  800c1a:	0f be d2             	movsbl %dl,%edx
  800c1d:	83 ea 30             	sub    $0x30,%edx
			dig = *s - 'a' + 10;
		else if (*s >= 'A' && *s <= 'Z')
			dig = *s - 'A' + 10;
		else
			break;
		if (dig >= base)
  800c20:	3b 55 10             	cmp    0x10(%ebp),%edx
  800c23:	7d 3a                	jge    800c5f <strtol+0xc5>
			break;
		s++, val = (val * base) + dig;
  800c25:	83 c1 01             	add    $0x1,%ecx
  800c28:	0f af 45 10          	imul   0x10(%ebp),%eax
  800c2c:	01 d0                	add    %edx,%eax
		if (*s >= '0' && *s <= '9')
  800c2e:	0f b6 11             	movzbl (%ecx),%edx
  800c31:	8d 72 d0             	lea    -0x30(%edx),%esi
  800c34:	89 f3                	mov    %esi,%ebx
  800c36:	80 fb 09             	cmp    $0x9,%bl
  800c39:	76 df                	jbe    800c1a <strtol+0x80>
		else if (*s >= 'a' && *s <= 'z')
  800c3b:	8d 72 9f             	lea    -0x61(%edx),%esi
  800c3e:	89 f3                	mov    %esi,%ebx
  800c40:	80 fb 19             	cmp    $0x19,%bl
  800c43:	77 08                	ja     800c4d <strtol+0xb3>
			dig = *s - 'a' + 10;
  800c45:	0f be d2             	movsbl %dl,%edx
  800c48:	83 ea 57             	sub    $0x57,%edx
  800c4b:	eb d3                	jmp    800c20 <strtol+0x86>
		else if (*s >= 'A' && *s <= 'Z')
  800c4d:	8d 72 bf             	lea    -0x41(%edx),%esi
  800c50:	89 f3                	mov    %esi,%ebx
  800c52:	80 fb 19             	cmp    $0x19,%bl
  800c55:	77 08                	ja     800c5f <strtol+0xc5>
			dig = *s - 'A' + 10;
  800c57:	0f be d2             	movsbl %dl,%edx
  800c5a:	83 ea 37             	sub    $0x37,%edx
  800c5d:	eb c1                	jmp    800c20 <strtol+0x86>
		// we don't properly detect overflow!
	}

	if (endptr)
  800c5f:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800c63:	74 05                	je     800c6a <strtol+0xd0>
		*endptr = (char *) s;
  800c65:	8b 75 0c             	mov    0xc(%ebp),%esi
  800c68:	89 0e                	mov    %ecx,(%esi)
	return (neg ? -val : val);
  800c6a:	89 c2                	mov    %eax,%edx
  800c6c:	f7 da                	neg    %edx
  800c6e:	85 ff                	test   %edi,%edi
  800c70:	0f 45 c2             	cmovne %edx,%eax
}
  800c73:	5b                   	pop    %ebx
  800c74:	5e                   	pop    %esi
  800c75:	5f                   	pop    %edi
  800c76:	5d                   	pop    %ebp
  800c77:	c3                   	ret    

00800c78 <sys_cputs>:
	return ret;
}

void
sys_cputs(const char *s, size_t len)
{
  800c78:	f3 0f 1e fb          	endbr32 
  800c7c:	55                   	push   %ebp
  800c7d:	89 e5                	mov    %esp,%ebp
  800c7f:	57                   	push   %edi
  800c80:	56                   	push   %esi
  800c81:	53                   	push   %ebx
	asm volatile("int %1\n"
  800c82:	b8 00 00 00 00       	mov    $0x0,%eax
  800c87:	8b 55 08             	mov    0x8(%ebp),%edx
  800c8a:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800c8d:	89 c3                	mov    %eax,%ebx
  800c8f:	89 c7                	mov    %eax,%edi
  800c91:	89 c6                	mov    %eax,%esi
  800c93:	cd 30                	int    $0x30
	syscall(SYS_cputs, 0, (uint32_t)s, len, 0, 0, 0);
}
  800c95:	5b                   	pop    %ebx
  800c96:	5e                   	pop    %esi
  800c97:	5f                   	pop    %edi
  800c98:	5d                   	pop    %ebp
  800c99:	c3                   	ret    

00800c9a <sys_cgetc>:

int
sys_cgetc(void)
{
  800c9a:	f3 0f 1e fb          	endbr32 
  800c9e:	55                   	push   %ebp
  800c9f:	89 e5                	mov    %esp,%ebp
  800ca1:	57                   	push   %edi
  800ca2:	56                   	push   %esi
  800ca3:	53                   	push   %ebx
	asm volatile("int %1\n"
  800ca4:	ba 00 00 00 00       	mov    $0x0,%edx
  800ca9:	b8 01 00 00 00       	mov    $0x1,%eax
  800cae:	89 d1                	mov    %edx,%ecx
  800cb0:	89 d3                	mov    %edx,%ebx
  800cb2:	89 d7                	mov    %edx,%edi
  800cb4:	89 d6                	mov    %edx,%esi
  800cb6:	cd 30                	int    $0x30
	return syscall(SYS_cgetc, 0, 0, 0, 0, 0, 0);
}
  800cb8:	5b                   	pop    %ebx
  800cb9:	5e                   	pop    %esi
  800cba:	5f                   	pop    %edi
  800cbb:	5d                   	pop    %ebp
  800cbc:	c3                   	ret    

00800cbd <sys_env_destroy>:

int
sys_env_destroy(envid_t envid)
{
  800cbd:	f3 0f 1e fb          	endbr32 
  800cc1:	55                   	push   %ebp
  800cc2:	89 e5                	mov    %esp,%ebp
  800cc4:	57                   	push   %edi
  800cc5:	56                   	push   %esi
  800cc6:	53                   	push   %ebx
  800cc7:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800cca:	b9 00 00 00 00       	mov    $0x0,%ecx
  800ccf:	8b 55 08             	mov    0x8(%ebp),%edx
  800cd2:	b8 03 00 00 00       	mov    $0x3,%eax
  800cd7:	89 cb                	mov    %ecx,%ebx
  800cd9:	89 cf                	mov    %ecx,%edi
  800cdb:	89 ce                	mov    %ecx,%esi
  800cdd:	cd 30                	int    $0x30
	if(check && ret > 0)
  800cdf:	85 c0                	test   %eax,%eax
  800ce1:	7f 08                	jg     800ceb <sys_env_destroy+0x2e>
	return syscall(SYS_env_destroy, 1, envid, 0, 0, 0, 0);
}
  800ce3:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ce6:	5b                   	pop    %ebx
  800ce7:	5e                   	pop    %esi
  800ce8:	5f                   	pop    %edi
  800ce9:	5d                   	pop    %ebp
  800cea:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ceb:	83 ec 0c             	sub    $0xc,%esp
  800cee:	50                   	push   %eax
  800cef:	6a 03                	push   $0x3
  800cf1:	68 3f 28 80 00       	push   $0x80283f
  800cf6:	6a 23                	push   $0x23
  800cf8:	68 5c 28 80 00       	push   $0x80285c
  800cfd:	e8 44 f5 ff ff       	call   800246 <_panic>

00800d02 <sys_getenvid>:

envid_t
sys_getenvid(void)
{
  800d02:	f3 0f 1e fb          	endbr32 
  800d06:	55                   	push   %ebp
  800d07:	89 e5                	mov    %esp,%ebp
  800d09:	57                   	push   %edi
  800d0a:	56                   	push   %esi
  800d0b:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d0c:	ba 00 00 00 00       	mov    $0x0,%edx
  800d11:	b8 02 00 00 00       	mov    $0x2,%eax
  800d16:	89 d1                	mov    %edx,%ecx
  800d18:	89 d3                	mov    %edx,%ebx
  800d1a:	89 d7                	mov    %edx,%edi
  800d1c:	89 d6                	mov    %edx,%esi
  800d1e:	cd 30                	int    $0x30
	 return syscall(SYS_getenvid, 0, 0, 0, 0, 0, 0);
}
  800d20:	5b                   	pop    %ebx
  800d21:	5e                   	pop    %esi
  800d22:	5f                   	pop    %edi
  800d23:	5d                   	pop    %ebp
  800d24:	c3                   	ret    

00800d25 <sys_yield>:

void
sys_yield(void)
{
  800d25:	f3 0f 1e fb          	endbr32 
  800d29:	55                   	push   %ebp
  800d2a:	89 e5                	mov    %esp,%ebp
  800d2c:	57                   	push   %edi
  800d2d:	56                   	push   %esi
  800d2e:	53                   	push   %ebx
	asm volatile("int %1\n"
  800d2f:	ba 00 00 00 00       	mov    $0x0,%edx
  800d34:	b8 0b 00 00 00       	mov    $0xb,%eax
  800d39:	89 d1                	mov    %edx,%ecx
  800d3b:	89 d3                	mov    %edx,%ebx
  800d3d:	89 d7                	mov    %edx,%edi
  800d3f:	89 d6                	mov    %edx,%esi
  800d41:	cd 30                	int    $0x30
	syscall(SYS_yield, 0, 0, 0, 0, 0, 0);
}
  800d43:	5b                   	pop    %ebx
  800d44:	5e                   	pop    %esi
  800d45:	5f                   	pop    %edi
  800d46:	5d                   	pop    %ebp
  800d47:	c3                   	ret    

00800d48 <sys_page_alloc>:

int
sys_page_alloc(envid_t envid, void *va, int perm)
{
  800d48:	f3 0f 1e fb          	endbr32 
  800d4c:	55                   	push   %ebp
  800d4d:	89 e5                	mov    %esp,%ebp
  800d4f:	57                   	push   %edi
  800d50:	56                   	push   %esi
  800d51:	53                   	push   %ebx
  800d52:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d55:	be 00 00 00 00       	mov    $0x0,%esi
  800d5a:	8b 55 08             	mov    0x8(%ebp),%edx
  800d5d:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800d60:	b8 04 00 00 00       	mov    $0x4,%eax
  800d65:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800d68:	89 f7                	mov    %esi,%edi
  800d6a:	cd 30                	int    $0x30
	if(check && ret > 0)
  800d6c:	85 c0                	test   %eax,%eax
  800d6e:	7f 08                	jg     800d78 <sys_page_alloc+0x30>
	return syscall(SYS_page_alloc, 1, envid, (uint32_t) va, perm, 0, 0);
}
  800d70:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800d73:	5b                   	pop    %ebx
  800d74:	5e                   	pop    %esi
  800d75:	5f                   	pop    %edi
  800d76:	5d                   	pop    %ebp
  800d77:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800d78:	83 ec 0c             	sub    $0xc,%esp
  800d7b:	50                   	push   %eax
  800d7c:	6a 04                	push   $0x4
  800d7e:	68 3f 28 80 00       	push   $0x80283f
  800d83:	6a 23                	push   $0x23
  800d85:	68 5c 28 80 00       	push   $0x80285c
  800d8a:	e8 b7 f4 ff ff       	call   800246 <_panic>

00800d8f <sys_page_map>:

int
sys_page_map(envid_t srcenv, void *srcva, envid_t dstenv, void *dstva, int perm)
{
  800d8f:	f3 0f 1e fb          	endbr32 
  800d93:	55                   	push   %ebp
  800d94:	89 e5                	mov    %esp,%ebp
  800d96:	57                   	push   %edi
  800d97:	56                   	push   %esi
  800d98:	53                   	push   %ebx
  800d99:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800d9c:	8b 55 08             	mov    0x8(%ebp),%edx
  800d9f:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800da2:	b8 05 00 00 00       	mov    $0x5,%eax
  800da7:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800daa:	8b 7d 14             	mov    0x14(%ebp),%edi
  800dad:	8b 75 18             	mov    0x18(%ebp),%esi
  800db0:	cd 30                	int    $0x30
	if(check && ret > 0)
  800db2:	85 c0                	test   %eax,%eax
  800db4:	7f 08                	jg     800dbe <sys_page_map+0x2f>
	return syscall(SYS_page_map, 1, srcenv, (uint32_t) srcva, dstenv, (uint32_t) dstva, perm);
}
  800db6:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800db9:	5b                   	pop    %ebx
  800dba:	5e                   	pop    %esi
  800dbb:	5f                   	pop    %edi
  800dbc:	5d                   	pop    %ebp
  800dbd:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800dbe:	83 ec 0c             	sub    $0xc,%esp
  800dc1:	50                   	push   %eax
  800dc2:	6a 05                	push   $0x5
  800dc4:	68 3f 28 80 00       	push   $0x80283f
  800dc9:	6a 23                	push   $0x23
  800dcb:	68 5c 28 80 00       	push   $0x80285c
  800dd0:	e8 71 f4 ff ff       	call   800246 <_panic>

00800dd5 <sys_page_unmap>:

int
sys_page_unmap(envid_t envid, void *va)
{
  800dd5:	f3 0f 1e fb          	endbr32 
  800dd9:	55                   	push   %ebp
  800dda:	89 e5                	mov    %esp,%ebp
  800ddc:	57                   	push   %edi
  800ddd:	56                   	push   %esi
  800dde:	53                   	push   %ebx
  800ddf:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800de2:	bb 00 00 00 00       	mov    $0x0,%ebx
  800de7:	8b 55 08             	mov    0x8(%ebp),%edx
  800dea:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ded:	b8 06 00 00 00       	mov    $0x6,%eax
  800df2:	89 df                	mov    %ebx,%edi
  800df4:	89 de                	mov    %ebx,%esi
  800df6:	cd 30                	int    $0x30
	if(check && ret > 0)
  800df8:	85 c0                	test   %eax,%eax
  800dfa:	7f 08                	jg     800e04 <sys_page_unmap+0x2f>
	return syscall(SYS_page_unmap, 1, envid, (uint32_t) va, 0, 0, 0);
}
  800dfc:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800dff:	5b                   	pop    %ebx
  800e00:	5e                   	pop    %esi
  800e01:	5f                   	pop    %edi
  800e02:	5d                   	pop    %ebp
  800e03:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e04:	83 ec 0c             	sub    $0xc,%esp
  800e07:	50                   	push   %eax
  800e08:	6a 06                	push   $0x6
  800e0a:	68 3f 28 80 00       	push   $0x80283f
  800e0f:	6a 23                	push   $0x23
  800e11:	68 5c 28 80 00       	push   $0x80285c
  800e16:	e8 2b f4 ff ff       	call   800246 <_panic>

00800e1b <sys_env_set_status>:

// sys_exofork is inlined in lib.h

int
sys_env_set_status(envid_t envid, int status)
{
  800e1b:	f3 0f 1e fb          	endbr32 
  800e1f:	55                   	push   %ebp
  800e20:	89 e5                	mov    %esp,%ebp
  800e22:	57                   	push   %edi
  800e23:	56                   	push   %esi
  800e24:	53                   	push   %ebx
  800e25:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e28:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e2d:	8b 55 08             	mov    0x8(%ebp),%edx
  800e30:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e33:	b8 08 00 00 00       	mov    $0x8,%eax
  800e38:	89 df                	mov    %ebx,%edi
  800e3a:	89 de                	mov    %ebx,%esi
  800e3c:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e3e:	85 c0                	test   %eax,%eax
  800e40:	7f 08                	jg     800e4a <sys_env_set_status+0x2f>
	return syscall(SYS_env_set_status, 1, envid, status, 0, 0, 0);
}
  800e42:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e45:	5b                   	pop    %ebx
  800e46:	5e                   	pop    %esi
  800e47:	5f                   	pop    %edi
  800e48:	5d                   	pop    %ebp
  800e49:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e4a:	83 ec 0c             	sub    $0xc,%esp
  800e4d:	50                   	push   %eax
  800e4e:	6a 08                	push   $0x8
  800e50:	68 3f 28 80 00       	push   $0x80283f
  800e55:	6a 23                	push   $0x23
  800e57:	68 5c 28 80 00       	push   $0x80285c
  800e5c:	e8 e5 f3 ff ff       	call   800246 <_panic>

00800e61 <sys_env_set_trapframe>:

int
sys_env_set_trapframe(envid_t envid, struct Trapframe *tf)
{
  800e61:	f3 0f 1e fb          	endbr32 
  800e65:	55                   	push   %ebp
  800e66:	89 e5                	mov    %esp,%ebp
  800e68:	57                   	push   %edi
  800e69:	56                   	push   %esi
  800e6a:	53                   	push   %ebx
  800e6b:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800e6e:	bb 00 00 00 00       	mov    $0x0,%ebx
  800e73:	8b 55 08             	mov    0x8(%ebp),%edx
  800e76:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800e79:	b8 09 00 00 00       	mov    $0x9,%eax
  800e7e:	89 df                	mov    %ebx,%edi
  800e80:	89 de                	mov    %ebx,%esi
  800e82:	cd 30                	int    $0x30
	if(check && ret > 0)
  800e84:	85 c0                	test   %eax,%eax
  800e86:	7f 08                	jg     800e90 <sys_env_set_trapframe+0x2f>
	return syscall(SYS_env_set_trapframe, 1, envid, (uint32_t) tf, 0, 0, 0);
}
  800e88:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800e8b:	5b                   	pop    %ebx
  800e8c:	5e                   	pop    %esi
  800e8d:	5f                   	pop    %edi
  800e8e:	5d                   	pop    %ebp
  800e8f:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800e90:	83 ec 0c             	sub    $0xc,%esp
  800e93:	50                   	push   %eax
  800e94:	6a 09                	push   $0x9
  800e96:	68 3f 28 80 00       	push   $0x80283f
  800e9b:	6a 23                	push   $0x23
  800e9d:	68 5c 28 80 00       	push   $0x80285c
  800ea2:	e8 9f f3 ff ff       	call   800246 <_panic>

00800ea7 <sys_env_set_pgfault_upcall>:

int
sys_env_set_pgfault_upcall(envid_t envid, void *upcall)
{
  800ea7:	f3 0f 1e fb          	endbr32 
  800eab:	55                   	push   %ebp
  800eac:	89 e5                	mov    %esp,%ebp
  800eae:	57                   	push   %edi
  800eaf:	56                   	push   %esi
  800eb0:	53                   	push   %ebx
  800eb1:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800eb4:	bb 00 00 00 00       	mov    $0x0,%ebx
  800eb9:	8b 55 08             	mov    0x8(%ebp),%edx
  800ebc:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800ebf:	b8 0a 00 00 00       	mov    $0xa,%eax
  800ec4:	89 df                	mov    %ebx,%edi
  800ec6:	89 de                	mov    %ebx,%esi
  800ec8:	cd 30                	int    $0x30
	if(check && ret > 0)
  800eca:	85 c0                	test   %eax,%eax
  800ecc:	7f 08                	jg     800ed6 <sys_env_set_pgfault_upcall+0x2f>
	return syscall(SYS_env_set_pgfault_upcall, 1, envid, (uint32_t) upcall, 0, 0, 0);
}
  800ece:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800ed1:	5b                   	pop    %ebx
  800ed2:	5e                   	pop    %esi
  800ed3:	5f                   	pop    %edi
  800ed4:	5d                   	pop    %ebp
  800ed5:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800ed6:	83 ec 0c             	sub    $0xc,%esp
  800ed9:	50                   	push   %eax
  800eda:	6a 0a                	push   $0xa
  800edc:	68 3f 28 80 00       	push   $0x80283f
  800ee1:	6a 23                	push   $0x23
  800ee3:	68 5c 28 80 00       	push   $0x80285c
  800ee8:	e8 59 f3 ff ff       	call   800246 <_panic>

00800eed <sys_ipc_try_send>:

int
sys_ipc_try_send(envid_t envid, uint32_t value, void *srcva, int perm)
{
  800eed:	f3 0f 1e fb          	endbr32 
  800ef1:	55                   	push   %ebp
  800ef2:	89 e5                	mov    %esp,%ebp
  800ef4:	57                   	push   %edi
  800ef5:	56                   	push   %esi
  800ef6:	53                   	push   %ebx
	asm volatile("int %1\n"
  800ef7:	8b 55 08             	mov    0x8(%ebp),%edx
  800efa:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  800efd:	b8 0c 00 00 00       	mov    $0xc,%eax
  800f02:	be 00 00 00 00       	mov    $0x0,%esi
  800f07:	8b 5d 10             	mov    0x10(%ebp),%ebx
  800f0a:	8b 7d 14             	mov    0x14(%ebp),%edi
  800f0d:	cd 30                	int    $0x30
	return syscall(SYS_ipc_try_send, 0, envid, value, (uint32_t) srcva, perm, 0);
}
  800f0f:	5b                   	pop    %ebx
  800f10:	5e                   	pop    %esi
  800f11:	5f                   	pop    %edi
  800f12:	5d                   	pop    %ebp
  800f13:	c3                   	ret    

00800f14 <sys_ipc_recv>:

int
sys_ipc_recv(void *dstva)
{
  800f14:	f3 0f 1e fb          	endbr32 
  800f18:	55                   	push   %ebp
  800f19:	89 e5                	mov    %esp,%ebp
  800f1b:	57                   	push   %edi
  800f1c:	56                   	push   %esi
  800f1d:	53                   	push   %ebx
  800f1e:	83 ec 0c             	sub    $0xc,%esp
	asm volatile("int %1\n"
  800f21:	b9 00 00 00 00       	mov    $0x0,%ecx
  800f26:	8b 55 08             	mov    0x8(%ebp),%edx
  800f29:	b8 0d 00 00 00       	mov    $0xd,%eax
  800f2e:	89 cb                	mov    %ecx,%ebx
  800f30:	89 cf                	mov    %ecx,%edi
  800f32:	89 ce                	mov    %ecx,%esi
  800f34:	cd 30                	int    $0x30
	if(check && ret > 0)
  800f36:	85 c0                	test   %eax,%eax
  800f38:	7f 08                	jg     800f42 <sys_ipc_recv+0x2e>
	return syscall(SYS_ipc_recv, 1, (uint32_t)dstva, 0, 0, 0, 0);
}
  800f3a:	8d 65 f4             	lea    -0xc(%ebp),%esp
  800f3d:	5b                   	pop    %ebx
  800f3e:	5e                   	pop    %esi
  800f3f:	5f                   	pop    %edi
  800f40:	5d                   	pop    %ebp
  800f41:	c3                   	ret    
		panic("syscall %d returned %d (> 0)", num, ret);
  800f42:	83 ec 0c             	sub    $0xc,%esp
  800f45:	50                   	push   %eax
  800f46:	6a 0d                	push   $0xd
  800f48:	68 3f 28 80 00       	push   $0x80283f
  800f4d:	6a 23                	push   $0x23
  800f4f:	68 5c 28 80 00       	push   $0x80285c
  800f54:	e8 ed f2 ff ff       	call   800246 <_panic>

00800f59 <pgfault>:
// Custom page fault handler - if faulting page is copy-on-write,
// map in our own private writable copy.
//
static void
pgfault(struct UTrapframe *utf)
{
  800f59:	f3 0f 1e fb          	endbr32 
  800f5d:	55                   	push   %ebp
  800f5e:	89 e5                	mov    %esp,%ebp
  800f60:	56                   	push   %esi
  800f61:	53                   	push   %ebx
  800f62:	8b 45 08             	mov    0x8(%ebp),%eax
	void *addr = (void *) utf->utf_fault_va;
  800f65:	8b 18                	mov    (%eax),%ebx
	/*
	将父进程空间中所有可以写的页表的部分全部标记为可读且COW【因此读取的时候不会进入pgfault，但是写的时候会触发pgfault】。
	而当父进程或者子进程任意一个发生了写的时候，因为页表现在都是不可写的，所以会触发异常，进入到我们设定的page fault处理例程，
	当检测到是对COW页的写操作的情况下，就可以将要写入的页的内容全部拷贝一份，重新映射。
	*/
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f67:	f6 40 04 02          	testb  $0x2,0x4(%eax)
  800f6b:	0f 84 b2 00 00 00    	je     801023 <pgfault+0xca>
  800f71:	89 d8                	mov    %ebx,%eax
  800f73:	c1 e8 16             	shr    $0x16,%eax
  800f76:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  800f7d:	a8 01                	test   $0x1,%al
  800f7f:	0f 84 9e 00 00 00    	je     801023 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800f85:	89 d8                	mov    %ebx,%eax
  800f87:	c1 e8 0c             	shr    $0xc,%eax
  800f8a:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800f91:	f6 c2 01             	test   $0x1,%dl
  800f94:	0f 84 89 00 00 00    	je     801023 <pgfault+0xca>
			(uvpt[PGNUM(addr)] & PTE_P) && (uvpt[PGNUM(addr)] & PTE_COW)))
  800f9a:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
    if (!((err & FEC_WR) && (uvpd[PDX(addr)] & PTE_P) && 
  800fa1:	f6 c4 08             	test   $0x8,%ah
  800fa4:	74 7d                	je     801023 <pgfault+0xca>
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
	//为该进程分配新的页面。
	envid_t envid=sys_getenvid();
  800fa6:	e8 57 fd ff ff       	call   800d02 <sys_getenvid>
  800fab:	89 c6                	mov    %eax,%esi
	r=sys_page_alloc(envid,(void*)PFTEMP,PTE_P|PTE_U|PTE_W);
  800fad:	83 ec 04             	sub    $0x4,%esp
  800fb0:	6a 07                	push   $0x7
  800fb2:	68 00 f0 7f 00       	push   $0x7ff000
  800fb7:	50                   	push   %eax
  800fb8:	e8 8b fd ff ff       	call   800d48 <sys_page_alloc>
	if(r<0){
  800fbd:	83 c4 10             	add    $0x10,%esp
  800fc0:	85 c0                	test   %eax,%eax
  800fc2:	78 73                	js     801037 <pgfault+0xde>
		 panic("pgfault: page allocation failed %e", r);
	}
	//解开了我的疑惑，为什么随着fork页空间会逐渐发生偏移。
	//迁移数据过去。
	addr=ROUNDDOWN(addr,PGSIZE);
  800fc4:	81 e3 00 f0 ff ff    	and    $0xfffff000,%ebx
	//拷贝内容。
	memmove(PFTEMP,addr,PGSIZE);
  800fca:	83 ec 04             	sub    $0x4,%esp
  800fcd:	68 00 10 00 00       	push   $0x1000
  800fd2:	53                   	push   %ebx
  800fd3:	68 00 f0 7f 00       	push   $0x7ff000
  800fd8:	e8 df fa ff ff       	call   800abc <memmove>
	//解除和addr的映射关系。
	r=sys_page_unmap(envid,(void*)addr);
  800fdd:	83 c4 08             	add    $0x8,%esp
  800fe0:	53                   	push   %ebx
  800fe1:	56                   	push   %esi
  800fe2:	e8 ee fd ff ff       	call   800dd5 <sys_page_unmap>
	if(r<0)
  800fe7:	83 c4 10             	add    $0x10,%esp
  800fea:	85 c0                	test   %eax,%eax
  800fec:	78 5b                	js     801049 <pgfault+0xf0>
	panic("pgfault: page unmap failed %e", r);
	r=sys_page_map(envid,PFTEMP,envid,addr,PTE_P|PTE_U|PTE_W);
  800fee:	83 ec 0c             	sub    $0xc,%esp
  800ff1:	6a 07                	push   $0x7
  800ff3:	53                   	push   %ebx
  800ff4:	56                   	push   %esi
  800ff5:	68 00 f0 7f 00       	push   $0x7ff000
  800ffa:	56                   	push   %esi
  800ffb:	e8 8f fd ff ff       	call   800d8f <sys_page_map>
	if(r<0)
  801000:	83 c4 20             	add    $0x20,%esp
  801003:	85 c0                	test   %eax,%eax
  801005:	78 54                	js     80105b <pgfault+0x102>
	panic("pgfault: page map failed %e", r);
	r=sys_page_unmap(envid,PFTEMP);
  801007:	83 ec 08             	sub    $0x8,%esp
  80100a:	68 00 f0 7f 00       	push   $0x7ff000
  80100f:	56                   	push   %esi
  801010:	e8 c0 fd ff ff       	call   800dd5 <sys_page_unmap>
	if(r<0)
  801015:	83 c4 10             	add    $0x10,%esp
  801018:	85 c0                	test   %eax,%eax
  80101a:	78 51                	js     80106d <pgfault+0x114>
	panic("pgfault: page unmap failed %e", r);
}
  80101c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80101f:	5b                   	pop    %ebx
  801020:	5e                   	pop    %esi
  801021:	5d                   	pop    %ebp
  801022:	c3                   	ret    
                panic("pgfault: it's not writable or attempt to access a non-cow page!");
  801023:	83 ec 04             	sub    $0x4,%esp
  801026:	68 6c 28 80 00       	push   $0x80286c
  80102b:	6a 2c                	push   $0x2c
  80102d:	68 1b 29 80 00       	push   $0x80291b
  801032:	e8 0f f2 ff ff       	call   800246 <_panic>
		 panic("pgfault: page allocation failed %e", r);
  801037:	50                   	push   %eax
  801038:	68 ac 28 80 00       	push   $0x8028ac
  80103d:	6a 31                	push   $0x31
  80103f:	68 1b 29 80 00       	push   $0x80291b
  801044:	e8 fd f1 ff ff       	call   800246 <_panic>
	panic("pgfault: page unmap failed %e", r);
  801049:	50                   	push   %eax
  80104a:	68 26 29 80 00       	push   $0x802926
  80104f:	6a 3b                	push   $0x3b
  801051:	68 1b 29 80 00       	push   $0x80291b
  801056:	e8 eb f1 ff ff       	call   800246 <_panic>
	panic("pgfault: page map failed %e", r);
  80105b:	50                   	push   %eax
  80105c:	68 44 29 80 00       	push   $0x802944
  801061:	6a 3e                	push   $0x3e
  801063:	68 1b 29 80 00       	push   $0x80291b
  801068:	e8 d9 f1 ff ff       	call   800246 <_panic>
	panic("pgfault: page unmap failed %e", r);
  80106d:	50                   	push   %eax
  80106e:	68 26 29 80 00       	push   $0x802926
  801073:	6a 41                	push   $0x41
  801075:	68 1b 29 80 00       	push   $0x80291b
  80107a:	e8 c7 f1 ff ff       	call   800246 <_panic>

0080107f <fork>:
//   Neither user exception stack should ever be marked copy-on-write,
//   so you must allocate a new page for the child's user exception stack.
//
envid_t
fork(void)
{
  80107f:	f3 0f 1e fb          	endbr32 
  801083:	55                   	push   %ebp
  801084:	89 e5                	mov    %esp,%ebp
  801086:	57                   	push   %edi
  801087:	56                   	push   %esi
  801088:	53                   	push   %ebx
  801089:	83 ec 28             	sub    $0x28,%esp
	// LAB 4: Your code here.
	envid_t envid;
	uintptr_t pageVa;
	unsigned pn;
	//设置pgfault情况下对应处理的函数。
	set_pgfault_handler(pgfault);
  80108c:	68 59 0f 80 00       	push   $0x800f59
  801091:	e8 49 0f 00 00       	call   801fdf <set_pgfault_handler>
// This must be inlined.  Exercise for reader: why?
static inline envid_t __attribute__((always_inline))
sys_exofork(void)
{
	envid_t ret;
	asm volatile("int %2"
  801096:	b8 07 00 00 00       	mov    $0x7,%eax
  80109b:	cd 30                	int    $0x30
  80109d:	89 c7                	mov    %eax,%edi
  80109f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
	//首先需要分配一个env，env_alloc是内核态调用的，因此只能去调系统调用对应的函数来请求分配一个环境描述符。
	envid=sys_exofork();
	//分配成功
	if(envid>0){
  8010a2:	83 c4 10             	add    $0x10,%esp
  8010a5:	85 c0                	test   %eax,%eax
  8010a7:	0f 8e 9d 01 00 00    	jle    80124a <fork+0x1cb>
		//接下来应该要拷贝父进程。当然这里让我吃惊的是直接可以调用对应的宏并且并没有去请求父进程。jos系统似乎是把所有的子进程都来源于同一进程，而不是父子继承关系。
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  8010ad:	bb 00 00 80 00       	mov    $0x800000,%ebx
  8010b2:	eb 5b                	jmp    80110f <fork+0x90>
			sys_page_map(0, addr, envid, addr, PTE_SYSCALL);
  8010b4:	83 ec 0c             	sub    $0xc,%esp
  8010b7:	68 07 0e 00 00       	push   $0xe07
  8010bc:	56                   	push   %esi
  8010bd:	ff 75 e4             	pushl  -0x1c(%ebp)
  8010c0:	56                   	push   %esi
  8010c1:	6a 00                	push   $0x0
  8010c3:	e8 c7 fc ff ff       	call   800d8f <sys_page_map>
  8010c8:	83 c4 20             	add    $0x20,%esp
  8010cb:	eb 30                	jmp    8010fd <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  8010cd:	83 ec 04             	sub    $0x4,%esp
  8010d0:	68 60 29 80 00       	push   $0x802960
  8010d5:	6a 63                	push   $0x63
  8010d7:	68 1b 29 80 00       	push   $0x80291b
  8010dc:	e8 65 f1 ff ff       	call   800246 <_panic>
            r = sys_page_map(0, addr, envid, addr, PTE_U | PTE_P);
  8010e1:	83 ec 0c             	sub    $0xc,%esp
  8010e4:	6a 05                	push   $0x5
  8010e6:	56                   	push   %esi
  8010e7:	ff 75 e4             	pushl  -0x1c(%ebp)
  8010ea:	56                   	push   %esi
  8010eb:	6a 00                	push   $0x0
  8010ed:	e8 9d fc ff ff       	call   800d8f <sys_page_map>
            if(r < 0)
  8010f2:	83 c4 20             	add    $0x20,%esp
  8010f5:	85 c0                	test   %eax,%eax
  8010f7:	0f 88 ac 00 00 00    	js     8011a9 <fork+0x12a>
		for(pageVa=UTEXT;pageVa<USTACKTOP;pageVa+=PGSIZE){
  8010fd:	81 c3 00 10 00 00    	add    $0x1000,%ebx
  801103:	81 fb 00 e0 bf ee    	cmp    $0xeebfe000,%ebx
  801109:	0f 84 ae 00 00 00    	je     8011bd <fork+0x13e>
			pn=PGNUM(pageVa);
			//检查权限，挨个copy页
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  80110f:	89 d8                	mov    %ebx,%eax
  801111:	c1 e8 16             	shr    $0x16,%eax
  801114:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  80111b:	a8 01                	test   $0x1,%al
  80111d:	74 de                	je     8010fd <fork+0x7e>
			pn=PGNUM(pageVa);
  80111f:	89 d8                	mov    %ebx,%eax
  801121:	c1 e8 0c             	shr    $0xc,%eax
			if((uvpd[PDX(pageVa)]&PTE_P)&&(uvpt[pn]&PTE_P)&&(uvpt[pn]&PTE_U)){
  801124:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  80112b:	f6 c2 01             	test   $0x1,%dl
  80112e:	74 cd                	je     8010fd <fork+0x7e>
  801130:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801137:	f6 c2 04             	test   $0x4,%dl
  80113a:	74 c1                	je     8010fd <fork+0x7e>
        addr = (void *)((uint32_t)pn * PGSIZE);
  80113c:	89 c6                	mov    %eax,%esi
  80113e:	c1 e6 0c             	shl    $0xc,%esi
        pte = uvpt[pn];
  801141:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
		if(pte&PTE_SHARE){
  801148:	f6 c4 04             	test   $0x4,%ah
  80114b:	0f 85 63 ff ff ff    	jne    8010b4 <fork+0x35>
        else if((pte & PTE_COW) || (pte & PTE_W))
  801151:	a9 02 08 00 00       	test   $0x802,%eax
  801156:	74 89                	je     8010e1 <fork+0x62>
            r = sys_page_map(0, addr, envid, addr, PTE_COW | PTE_U | PTE_P);
  801158:	83 ec 0c             	sub    $0xc,%esp
  80115b:	68 05 08 00 00       	push   $0x805
  801160:	56                   	push   %esi
  801161:	ff 75 e4             	pushl  -0x1c(%ebp)
  801164:	56                   	push   %esi
  801165:	6a 00                	push   $0x0
  801167:	e8 23 fc ff ff       	call   800d8f <sys_page_map>
            if(r < 0)
  80116c:	83 c4 20             	add    $0x20,%esp
  80116f:	85 c0                	test   %eax,%eax
  801171:	0f 88 56 ff ff ff    	js     8010cd <fork+0x4e>
            r = sys_page_map(0, addr, 0, addr, PTE_COW | PTE_U | PTE_P);
  801177:	83 ec 0c             	sub    $0xc,%esp
  80117a:	68 05 08 00 00       	push   $0x805
  80117f:	56                   	push   %esi
  801180:	6a 00                	push   $0x0
  801182:	56                   	push   %esi
  801183:	6a 00                	push   $0x0
  801185:	e8 05 fc ff ff       	call   800d8f <sys_page_map>
            if(r < 0)
  80118a:	83 c4 20             	add    $0x20,%esp
  80118d:	85 c0                	test   %eax,%eax
  80118f:	0f 89 68 ff ff ff    	jns    8010fd <fork+0x7e>
                panic("duppage: sys_page_map fail\n");
  801195:	83 ec 04             	sub    $0x4,%esp
  801198:	68 60 29 80 00       	push   $0x802960
  80119d:	6a 66                	push   $0x66
  80119f:	68 1b 29 80 00       	push   $0x80291b
  8011a4:	e8 9d f0 ff ff       	call   800246 <_panic>
                panic("duppage: sys_page_map fail\n");
  8011a9:	83 ec 04             	sub    $0x4,%esp
  8011ac:	68 60 29 80 00       	push   $0x802960
  8011b1:	6a 6c                	push   $0x6c
  8011b3:	68 1b 29 80 00       	push   $0x80291b
  8011b8:	e8 89 f0 ff ff       	call   800246 <_panic>
				duppage(envid,pn);}
			}
		//分配异常栈。
		int32_t flag=sys_page_alloc(envid,(void*)(UXSTACKTOP-PGSIZE),PTE_P|PTE_U|PTE_W);
  8011bd:	83 ec 04             	sub    $0x4,%esp
  8011c0:	6a 07                	push   $0x7
  8011c2:	68 00 f0 bf ee       	push   $0xeebff000
  8011c7:	57                   	push   %edi
  8011c8:	e8 7b fb ff ff       	call   800d48 <sys_page_alloc>
		if(flag<0){
  8011cd:	83 c4 10             	add    $0x10,%esp
  8011d0:	85 c0                	test   %eax,%eax
  8011d2:	78 31                	js     801205 <fork+0x186>
			panic("panic by alloc page");
		}
		//设置对应的异常处理函数。
		extern void _pgfault_upcall(void);
		flag=sys_env_set_pgfault_upcall(envid,_pgfault_upcall);
  8011d4:	83 ec 08             	sub    $0x8,%esp
  8011d7:	68 59 20 80 00       	push   $0x802059
  8011dc:	57                   	push   %edi
  8011dd:	e8 c5 fc ff ff       	call   800ea7 <sys_env_set_pgfault_upcall>
		if(flag<0){
  8011e2:	83 c4 10             	add    $0x10,%esp
  8011e5:	85 c0                	test   %eax,%eax
  8011e7:	78 33                	js     80121c <fork+0x19d>
			panic("panic by set pgfault upcall faction");
		}
		//设置子进程，等待调度。
		flag=sys_env_set_status(envid,ENV_RUNNABLE);
  8011e9:	83 ec 08             	sub    $0x8,%esp
  8011ec:	6a 02                	push   $0x2
  8011ee:	57                   	push   %edi
  8011ef:	e8 27 fc ff ff       	call   800e1b <sys_env_set_status>
		if(flag<0){
  8011f4:	83 c4 10             	add    $0x10,%esp
  8011f7:	85 c0                	test   %eax,%eax
  8011f9:	78 38                	js     801233 <fork+0x1b4>
		//否则报错。
		panic("panic by alloc envid");
	}

	
}
  8011fb:	89 f8                	mov    %edi,%eax
  8011fd:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801200:	5b                   	pop    %ebx
  801201:	5e                   	pop    %esi
  801202:	5f                   	pop    %edi
  801203:	5d                   	pop    %ebp
  801204:	c3                   	ret    
			panic("panic by alloc page");
  801205:	83 ec 04             	sub    $0x4,%esp
  801208:	68 7c 29 80 00       	push   $0x80297c
  80120d:	68 98 00 00 00       	push   $0x98
  801212:	68 1b 29 80 00       	push   $0x80291b
  801217:	e8 2a f0 ff ff       	call   800246 <_panic>
			panic("panic by set pgfault upcall faction");
  80121c:	83 ec 04             	sub    $0x4,%esp
  80121f:	68 d0 28 80 00       	push   $0x8028d0
  801224:	68 9e 00 00 00       	push   $0x9e
  801229:	68 1b 29 80 00       	push   $0x80291b
  80122e:	e8 13 f0 ff ff       	call   800246 <_panic>
			panic("panic by set env status to ENV_RUNABLE");
  801233:	83 ec 04             	sub    $0x4,%esp
  801236:	68 f4 28 80 00       	push   $0x8028f4
  80123b:	68 a3 00 00 00       	push   $0xa3
  801240:	68 1b 29 80 00       	push   $0x80291b
  801245:	e8 fc ef ff ff       	call   800246 <_panic>
	else if(envid==0){
  80124a:	75 19                	jne    801265 <fork+0x1e6>
        thisenv = &envs[ENVX(sys_getenvid())];	//在子进程中设置thisenv为自己
  80124c:	e8 b1 fa ff ff       	call   800d02 <sys_getenvid>
  801251:	25 ff 03 00 00       	and    $0x3ff,%eax
  801256:	6b c0 7c             	imul   $0x7c,%eax,%eax
  801259:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  80125e:	a3 04 40 80 00       	mov    %eax,0x804004
		return 0;
  801263:	eb 96                	jmp    8011fb <fork+0x17c>
		panic("panic by alloc envid");
  801265:	83 ec 04             	sub    $0x4,%esp
  801268:	68 90 29 80 00       	push   $0x802990
  80126d:	68 ad 00 00 00       	push   $0xad
  801272:	68 1b 29 80 00       	push   $0x80291b
  801277:	e8 ca ef ff ff       	call   800246 <_panic>

0080127c <sfork>:

// Challenge!
int
sfork(void)
{
  80127c:	f3 0f 1e fb          	endbr32 
  801280:	55                   	push   %ebp
  801281:	89 e5                	mov    %esp,%ebp
  801283:	83 ec 0c             	sub    $0xc,%esp
	panic("sfork not implemented");
  801286:	68 a5 29 80 00       	push   $0x8029a5
  80128b:	68 b7 00 00 00       	push   $0xb7
  801290:	68 1b 29 80 00       	push   $0x80291b
  801295:	e8 ac ef ff ff       	call   800246 <_panic>

0080129a <fd2num>:
// File descriptor manipulators
// --------------------------------------------------------------

int
fd2num(struct Fd *fd)
{
  80129a:	f3 0f 1e fb          	endbr32 
  80129e:	55                   	push   %ebp
  80129f:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012a1:	8b 45 08             	mov    0x8(%ebp),%eax
  8012a4:	05 00 00 00 30       	add    $0x30000000,%eax
  8012a9:	c1 e8 0c             	shr    $0xc,%eax
}
  8012ac:	5d                   	pop    %ebp
  8012ad:	c3                   	ret    

008012ae <fd2data>:

char*
fd2data(struct Fd *fd)
{
  8012ae:	f3 0f 1e fb          	endbr32 
  8012b2:	55                   	push   %ebp
  8012b3:	89 e5                	mov    %esp,%ebp
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8012b5:	8b 45 08             	mov    0x8(%ebp),%eax
  8012b8:	05 00 00 00 30       	add    $0x30000000,%eax
	return INDEX2DATA(fd2num(fd));
  8012bd:	25 00 f0 ff ff       	and    $0xfffff000,%eax
  8012c2:	2d 00 00 fe 2f       	sub    $0x2ffe0000,%eax
}
  8012c7:	5d                   	pop    %ebp
  8012c8:	c3                   	ret    

008012c9 <fd_alloc>:
// Returns 0 on success, < 0 on error.  Errors are:
//	-E_MAX_FD: no more file descriptors
// On error, *fd_store is set to 0.
int
fd_alloc(struct Fd **fd_store)
{
  8012c9:	f3 0f 1e fb          	endbr32 
  8012cd:	55                   	push   %ebp
  8012ce:	89 e5                	mov    %esp,%ebp
  8012d0:	b8 00 00 00 d0       	mov    $0xd0000000,%eax
	int i;
	struct Fd *fd;

	for (i = 0; i < MAXFD; i++) {
		fd = INDEX2FD(i);
		if ((uvpd[PDX(fd)] & PTE_P) == 0 || (uvpt[PGNUM(fd)] & PTE_P) == 0) {
  8012d5:	89 c2                	mov    %eax,%edx
  8012d7:	c1 ea 16             	shr    $0x16,%edx
  8012da:	8b 14 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%edx
  8012e1:	f6 c2 01             	test   $0x1,%dl
  8012e4:	74 2d                	je     801313 <fd_alloc+0x4a>
  8012e6:	89 c2                	mov    %eax,%edx
  8012e8:	c1 ea 0c             	shr    $0xc,%edx
  8012eb:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  8012f2:	f6 c2 01             	test   $0x1,%dl
  8012f5:	74 1c                	je     801313 <fd_alloc+0x4a>
  8012f7:	05 00 10 00 00       	add    $0x1000,%eax
	for (i = 0; i < MAXFD; i++) {
  8012fc:	3d 00 00 02 d0       	cmp    $0xd0020000,%eax
  801301:	75 d2                	jne    8012d5 <fd_alloc+0xc>
			*fd_store = fd;
			return 0;
		}
	}
	*fd_store = 0;
  801303:	8b 45 08             	mov    0x8(%ebp),%eax
  801306:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_MAX_OPEN;
  80130c:	b8 f6 ff ff ff       	mov    $0xfffffff6,%eax
  801311:	eb 0a                	jmp    80131d <fd_alloc+0x54>
			*fd_store = fd;
  801313:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801316:	89 01                	mov    %eax,(%ecx)
			return 0;
  801318:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80131d:	5d                   	pop    %ebp
  80131e:	c3                   	ret    

0080131f <fd_lookup>:
// Returns 0 on success (the page is in range and mapped), < 0 on error.
// Errors are:
//	-E_INVAL: fdnum was either not in range or not mapped.
int
fd_lookup(int fdnum, struct Fd **fd_store)
{
  80131f:	f3 0f 1e fb          	endbr32 
  801323:	55                   	push   %ebp
  801324:	89 e5                	mov    %esp,%ebp
  801326:	8b 45 08             	mov    0x8(%ebp),%eax
	struct Fd *fd;

	if (fdnum < 0 || fdnum >= MAXFD) {
  801329:	83 f8 1f             	cmp    $0x1f,%eax
  80132c:	77 30                	ja     80135e <fd_lookup+0x3f>
		if (debug)
			cprintf("[%08x] bad fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	fd = INDEX2FD(fdnum);
  80132e:	c1 e0 0c             	shl    $0xc,%eax
  801331:	2d 00 00 00 30       	sub    $0x30000000,%eax
	if (!(uvpd[PDX(fd)] & PTE_P) || !(uvpt[PGNUM(fd)] & PTE_P)) {
  801336:	8b 15 00 dd 7b ef    	mov    0xef7bdd00,%edx
  80133c:	f6 c2 01             	test   $0x1,%dl
  80133f:	74 24                	je     801365 <fd_lookup+0x46>
  801341:	89 c2                	mov    %eax,%edx
  801343:	c1 ea 0c             	shr    $0xc,%edx
  801346:	8b 14 95 00 00 40 ef 	mov    -0x10c00000(,%edx,4),%edx
  80134d:	f6 c2 01             	test   $0x1,%dl
  801350:	74 1a                	je     80136c <fd_lookup+0x4d>
		if (debug)
			cprintf("[%08x] closed fd %d\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	*fd_store = fd;
  801352:	8b 55 0c             	mov    0xc(%ebp),%edx
  801355:	89 02                	mov    %eax,(%edx)
	return 0;
  801357:	b8 00 00 00 00       	mov    $0x0,%eax
}
  80135c:	5d                   	pop    %ebp
  80135d:	c3                   	ret    
		return -E_INVAL;
  80135e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801363:	eb f7                	jmp    80135c <fd_lookup+0x3d>
		return -E_INVAL;
  801365:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  80136a:	eb f0                	jmp    80135c <fd_lookup+0x3d>
  80136c:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801371:	eb e9                	jmp    80135c <fd_lookup+0x3d>

00801373 <dev_lookup>:
	0
};

int
dev_lookup(int dev_id, struct Dev **dev)
{
  801373:	f3 0f 1e fb          	endbr32 
  801377:	55                   	push   %ebp
  801378:	89 e5                	mov    %esp,%ebp
  80137a:	83 ec 08             	sub    $0x8,%esp
  80137d:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801380:	ba 38 2a 80 00       	mov    $0x802a38,%edx
	int i;
	for (i = 0; devtab[i]; i++)
  801385:	b8 04 30 80 00       	mov    $0x803004,%eax
		if (devtab[i]->dev_id == dev_id) {
  80138a:	39 08                	cmp    %ecx,(%eax)
  80138c:	74 33                	je     8013c1 <dev_lookup+0x4e>
  80138e:	83 c2 04             	add    $0x4,%edx
	for (i = 0; devtab[i]; i++)
  801391:	8b 02                	mov    (%edx),%eax
  801393:	85 c0                	test   %eax,%eax
  801395:	75 f3                	jne    80138a <dev_lookup+0x17>
			*dev = devtab[i];
			return 0;
		}
	cprintf("[%08x] unknown device type %d\n", thisenv->env_id, dev_id);
  801397:	a1 04 40 80 00       	mov    0x804004,%eax
  80139c:	8b 40 48             	mov    0x48(%eax),%eax
  80139f:	83 ec 04             	sub    $0x4,%esp
  8013a2:	51                   	push   %ecx
  8013a3:	50                   	push   %eax
  8013a4:	68 bc 29 80 00       	push   $0x8029bc
  8013a9:	e8 7f ef ff ff       	call   80032d <cprintf>
	*dev = 0;
  8013ae:	8b 45 0c             	mov    0xc(%ebp),%eax
  8013b1:	c7 00 00 00 00 00    	movl   $0x0,(%eax)
	return -E_INVAL;
  8013b7:	83 c4 10             	add    $0x10,%esp
  8013ba:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
}
  8013bf:	c9                   	leave  
  8013c0:	c3                   	ret    
			*dev = devtab[i];
  8013c1:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  8013c4:	89 01                	mov    %eax,(%ecx)
			return 0;
  8013c6:	b8 00 00 00 00       	mov    $0x0,%eax
  8013cb:	eb f2                	jmp    8013bf <dev_lookup+0x4c>

008013cd <fd_close>:
{
  8013cd:	f3 0f 1e fb          	endbr32 
  8013d1:	55                   	push   %ebp
  8013d2:	89 e5                	mov    %esp,%ebp
  8013d4:	57                   	push   %edi
  8013d5:	56                   	push   %esi
  8013d6:	53                   	push   %ebx
  8013d7:	83 ec 24             	sub    $0x24,%esp
  8013da:	8b 75 08             	mov    0x8(%ebp),%esi
  8013dd:	8b 7d 0c             	mov    0xc(%ebp),%edi
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8013e0:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8013e3:	50                   	push   %eax
	return ((uintptr_t) fd - FDTABLE) / PGSIZE;
  8013e4:	8d 86 00 00 00 30    	lea    0x30000000(%esi),%eax
  8013ea:	c1 e8 0c             	shr    $0xc,%eax
	if ((r = fd_lookup(fd2num(fd), &fd2)) < 0
  8013ed:	50                   	push   %eax
  8013ee:	e8 2c ff ff ff       	call   80131f <fd_lookup>
  8013f3:	89 c3                	mov    %eax,%ebx
  8013f5:	83 c4 10             	add    $0x10,%esp
  8013f8:	85 c0                	test   %eax,%eax
  8013fa:	78 05                	js     801401 <fd_close+0x34>
	    || fd != fd2)
  8013fc:	39 75 e4             	cmp    %esi,-0x1c(%ebp)
  8013ff:	74 16                	je     801417 <fd_close+0x4a>
		return (must_exist ? r : 0);
  801401:	89 f8                	mov    %edi,%eax
  801403:	84 c0                	test   %al,%al
  801405:	b8 00 00 00 00       	mov    $0x0,%eax
  80140a:	0f 44 d8             	cmove  %eax,%ebx
}
  80140d:	89 d8                	mov    %ebx,%eax
  80140f:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801412:	5b                   	pop    %ebx
  801413:	5e                   	pop    %esi
  801414:	5f                   	pop    %edi
  801415:	5d                   	pop    %ebp
  801416:	c3                   	ret    
	if ((r = dev_lookup(fd->fd_dev_id, &dev)) >= 0) {
  801417:	83 ec 08             	sub    $0x8,%esp
  80141a:	8d 45 e0             	lea    -0x20(%ebp),%eax
  80141d:	50                   	push   %eax
  80141e:	ff 36                	pushl  (%esi)
  801420:	e8 4e ff ff ff       	call   801373 <dev_lookup>
  801425:	89 c3                	mov    %eax,%ebx
  801427:	83 c4 10             	add    $0x10,%esp
  80142a:	85 c0                	test   %eax,%eax
  80142c:	78 1a                	js     801448 <fd_close+0x7b>
		if (dev->dev_close)
  80142e:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801431:	8b 40 10             	mov    0x10(%eax),%eax
			r = 0;
  801434:	bb 00 00 00 00       	mov    $0x0,%ebx
		if (dev->dev_close)
  801439:	85 c0                	test   %eax,%eax
  80143b:	74 0b                	je     801448 <fd_close+0x7b>
			r = (*dev->dev_close)(fd);
  80143d:	83 ec 0c             	sub    $0xc,%esp
  801440:	56                   	push   %esi
  801441:	ff d0                	call   *%eax
  801443:	89 c3                	mov    %eax,%ebx
  801445:	83 c4 10             	add    $0x10,%esp
	(void) sys_page_unmap(0, fd);
  801448:	83 ec 08             	sub    $0x8,%esp
  80144b:	56                   	push   %esi
  80144c:	6a 00                	push   $0x0
  80144e:	e8 82 f9 ff ff       	call   800dd5 <sys_page_unmap>
	return r;
  801453:	83 c4 10             	add    $0x10,%esp
  801456:	eb b5                	jmp    80140d <fd_close+0x40>

00801458 <close>:

int
close(int fdnum)
{
  801458:	f3 0f 1e fb          	endbr32 
  80145c:	55                   	push   %ebp
  80145d:	89 e5                	mov    %esp,%ebp
  80145f:	83 ec 20             	sub    $0x20,%esp
	struct Fd *fd;
	int r;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801462:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801465:	50                   	push   %eax
  801466:	ff 75 08             	pushl  0x8(%ebp)
  801469:	e8 b1 fe ff ff       	call   80131f <fd_lookup>
  80146e:	83 c4 10             	add    $0x10,%esp
  801471:	85 c0                	test   %eax,%eax
  801473:	79 02                	jns    801477 <close+0x1f>
		return r;
	else
		return fd_close(fd, 1);
}
  801475:	c9                   	leave  
  801476:	c3                   	ret    
		return fd_close(fd, 1);
  801477:	83 ec 08             	sub    $0x8,%esp
  80147a:	6a 01                	push   $0x1
  80147c:	ff 75 f4             	pushl  -0xc(%ebp)
  80147f:	e8 49 ff ff ff       	call   8013cd <fd_close>
  801484:	83 c4 10             	add    $0x10,%esp
  801487:	eb ec                	jmp    801475 <close+0x1d>

00801489 <close_all>:

void
close_all(void)
{
  801489:	f3 0f 1e fb          	endbr32 
  80148d:	55                   	push   %ebp
  80148e:	89 e5                	mov    %esp,%ebp
  801490:	53                   	push   %ebx
  801491:	83 ec 04             	sub    $0x4,%esp
	int i;
	for (i = 0; i < MAXFD; i++)
  801494:	bb 00 00 00 00       	mov    $0x0,%ebx
		close(i);
  801499:	83 ec 0c             	sub    $0xc,%esp
  80149c:	53                   	push   %ebx
  80149d:	e8 b6 ff ff ff       	call   801458 <close>
	for (i = 0; i < MAXFD; i++)
  8014a2:	83 c3 01             	add    $0x1,%ebx
  8014a5:	83 c4 10             	add    $0x10,%esp
  8014a8:	83 fb 20             	cmp    $0x20,%ebx
  8014ab:	75 ec                	jne    801499 <close_all+0x10>
}
  8014ad:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8014b0:	c9                   	leave  
  8014b1:	c3                   	ret    

008014b2 <dup>:
// file and the file offset of the other.
// Closes any previously open file descriptor at 'newfdnum'.
// This is implemented using virtual memory tricks (of course!).
int
dup(int oldfdnum, int newfdnum)
{
  8014b2:	f3 0f 1e fb          	endbr32 
  8014b6:	55                   	push   %ebp
  8014b7:	89 e5                	mov    %esp,%ebp
  8014b9:	57                   	push   %edi
  8014ba:	56                   	push   %esi
  8014bb:	53                   	push   %ebx
  8014bc:	83 ec 24             	sub    $0x24,%esp
	int r;
	char *ova, *nva;
	pte_t pte;
	struct Fd *oldfd, *newfd;

	if ((r = fd_lookup(oldfdnum, &oldfd)) < 0)
  8014bf:	8d 45 e4             	lea    -0x1c(%ebp),%eax
  8014c2:	50                   	push   %eax
  8014c3:	ff 75 08             	pushl  0x8(%ebp)
  8014c6:	e8 54 fe ff ff       	call   80131f <fd_lookup>
  8014cb:	89 c3                	mov    %eax,%ebx
  8014cd:	83 c4 10             	add    $0x10,%esp
  8014d0:	85 c0                	test   %eax,%eax
  8014d2:	0f 88 81 00 00 00    	js     801559 <dup+0xa7>
		return r;
	close(newfdnum);
  8014d8:	83 ec 0c             	sub    $0xc,%esp
  8014db:	ff 75 0c             	pushl  0xc(%ebp)
  8014de:	e8 75 ff ff ff       	call   801458 <close>

	newfd = INDEX2FD(newfdnum);
  8014e3:	8b 75 0c             	mov    0xc(%ebp),%esi
  8014e6:	c1 e6 0c             	shl    $0xc,%esi
  8014e9:	81 ee 00 00 00 30    	sub    $0x30000000,%esi
	ova = fd2data(oldfd);
  8014ef:	83 c4 04             	add    $0x4,%esp
  8014f2:	ff 75 e4             	pushl  -0x1c(%ebp)
  8014f5:	e8 b4 fd ff ff       	call   8012ae <fd2data>
  8014fa:	89 c3                	mov    %eax,%ebx
	nva = fd2data(newfd);
  8014fc:	89 34 24             	mov    %esi,(%esp)
  8014ff:	e8 aa fd ff ff       	call   8012ae <fd2data>
  801504:	83 c4 10             	add    $0x10,%esp
  801507:	89 c7                	mov    %eax,%edi

	if ((uvpd[PDX(ova)] & PTE_P) && (uvpt[PGNUM(ova)] & PTE_P))
  801509:	89 d8                	mov    %ebx,%eax
  80150b:	c1 e8 16             	shr    $0x16,%eax
  80150e:	8b 04 85 00 d0 7b ef 	mov    -0x10843000(,%eax,4),%eax
  801515:	a8 01                	test   $0x1,%al
  801517:	74 11                	je     80152a <dup+0x78>
  801519:	89 d8                	mov    %ebx,%eax
  80151b:	c1 e8 0c             	shr    $0xc,%eax
  80151e:	8b 14 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%edx
  801525:	f6 c2 01             	test   $0x1,%dl
  801528:	75 39                	jne    801563 <dup+0xb1>
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
			goto err;
	if ((r = sys_page_map(0, oldfd, 0, newfd, uvpt[PGNUM(oldfd)] & PTE_SYSCALL)) < 0)
  80152a:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  80152d:	89 d0                	mov    %edx,%eax
  80152f:	c1 e8 0c             	shr    $0xc,%eax
  801532:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  801539:	83 ec 0c             	sub    $0xc,%esp
  80153c:	25 07 0e 00 00       	and    $0xe07,%eax
  801541:	50                   	push   %eax
  801542:	56                   	push   %esi
  801543:	6a 00                	push   $0x0
  801545:	52                   	push   %edx
  801546:	6a 00                	push   $0x0
  801548:	e8 42 f8 ff ff       	call   800d8f <sys_page_map>
  80154d:	89 c3                	mov    %eax,%ebx
  80154f:	83 c4 20             	add    $0x20,%esp
  801552:	85 c0                	test   %eax,%eax
  801554:	78 31                	js     801587 <dup+0xd5>
		goto err;

	return newfdnum;
  801556:	8b 5d 0c             	mov    0xc(%ebp),%ebx

err:
	sys_page_unmap(0, newfd);
	sys_page_unmap(0, nva);
	return r;
}
  801559:	89 d8                	mov    %ebx,%eax
  80155b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  80155e:	5b                   	pop    %ebx
  80155f:	5e                   	pop    %esi
  801560:	5f                   	pop    %edi
  801561:	5d                   	pop    %ebp
  801562:	c3                   	ret    
		if ((r = sys_page_map(0, ova, 0, nva, uvpt[PGNUM(ova)] & PTE_SYSCALL)) < 0)
  801563:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
  80156a:	83 ec 0c             	sub    $0xc,%esp
  80156d:	25 07 0e 00 00       	and    $0xe07,%eax
  801572:	50                   	push   %eax
  801573:	57                   	push   %edi
  801574:	6a 00                	push   $0x0
  801576:	53                   	push   %ebx
  801577:	6a 00                	push   $0x0
  801579:	e8 11 f8 ff ff       	call   800d8f <sys_page_map>
  80157e:	89 c3                	mov    %eax,%ebx
  801580:	83 c4 20             	add    $0x20,%esp
  801583:	85 c0                	test   %eax,%eax
  801585:	79 a3                	jns    80152a <dup+0x78>
	sys_page_unmap(0, newfd);
  801587:	83 ec 08             	sub    $0x8,%esp
  80158a:	56                   	push   %esi
  80158b:	6a 00                	push   $0x0
  80158d:	e8 43 f8 ff ff       	call   800dd5 <sys_page_unmap>
	sys_page_unmap(0, nva);
  801592:	83 c4 08             	add    $0x8,%esp
  801595:	57                   	push   %edi
  801596:	6a 00                	push   $0x0
  801598:	e8 38 f8 ff ff       	call   800dd5 <sys_page_unmap>
	return r;
  80159d:	83 c4 10             	add    $0x10,%esp
  8015a0:	eb b7                	jmp    801559 <dup+0xa7>

008015a2 <read>:

ssize_t
read(int fdnum, void *buf, size_t n)
{
  8015a2:	f3 0f 1e fb          	endbr32 
  8015a6:	55                   	push   %ebp
  8015a7:	89 e5                	mov    %esp,%ebp
  8015a9:	53                   	push   %ebx
  8015aa:	83 ec 1c             	sub    $0x1c,%esp
  8015ad:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8015b0:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8015b3:	50                   	push   %eax
  8015b4:	53                   	push   %ebx
  8015b5:	e8 65 fd ff ff       	call   80131f <fd_lookup>
  8015ba:	83 c4 10             	add    $0x10,%esp
  8015bd:	85 c0                	test   %eax,%eax
  8015bf:	78 3f                	js     801600 <read+0x5e>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8015c1:	83 ec 08             	sub    $0x8,%esp
  8015c4:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8015c7:	50                   	push   %eax
  8015c8:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8015cb:	ff 30                	pushl  (%eax)
  8015cd:	e8 a1 fd ff ff       	call   801373 <dev_lookup>
  8015d2:	83 c4 10             	add    $0x10,%esp
  8015d5:	85 c0                	test   %eax,%eax
  8015d7:	78 27                	js     801600 <read+0x5e>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_WRONLY) {
  8015d9:	8b 55 f0             	mov    -0x10(%ebp),%edx
  8015dc:	8b 42 08             	mov    0x8(%edx),%eax
  8015df:	83 e0 03             	and    $0x3,%eax
  8015e2:	83 f8 01             	cmp    $0x1,%eax
  8015e5:	74 1e                	je     801605 <read+0x63>
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_read)
  8015e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8015ea:	8b 40 08             	mov    0x8(%eax),%eax
  8015ed:	85 c0                	test   %eax,%eax
  8015ef:	74 35                	je     801626 <read+0x84>
		return -E_NOT_SUPP;
	return (*dev->dev_read)(fd, buf, n);
  8015f1:	83 ec 04             	sub    $0x4,%esp
  8015f4:	ff 75 10             	pushl  0x10(%ebp)
  8015f7:	ff 75 0c             	pushl  0xc(%ebp)
  8015fa:	52                   	push   %edx
  8015fb:	ff d0                	call   *%eax
  8015fd:	83 c4 10             	add    $0x10,%esp
}
  801600:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801603:	c9                   	leave  
  801604:	c3                   	ret    
		cprintf("[%08x] read %d -- bad mode\n", thisenv->env_id, fdnum);
  801605:	a1 04 40 80 00       	mov    0x804004,%eax
  80160a:	8b 40 48             	mov    0x48(%eax),%eax
  80160d:	83 ec 04             	sub    $0x4,%esp
  801610:	53                   	push   %ebx
  801611:	50                   	push   %eax
  801612:	68 fd 29 80 00       	push   $0x8029fd
  801617:	e8 11 ed ff ff       	call   80032d <cprintf>
		return -E_INVAL;
  80161c:	83 c4 10             	add    $0x10,%esp
  80161f:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  801624:	eb da                	jmp    801600 <read+0x5e>
		return -E_NOT_SUPP;
  801626:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  80162b:	eb d3                	jmp    801600 <read+0x5e>

0080162d <readn>:

ssize_t
readn(int fdnum, void *buf, size_t n)
{
  80162d:	f3 0f 1e fb          	endbr32 
  801631:	55                   	push   %ebp
  801632:	89 e5                	mov    %esp,%ebp
  801634:	57                   	push   %edi
  801635:	56                   	push   %esi
  801636:	53                   	push   %ebx
  801637:	83 ec 0c             	sub    $0xc,%esp
  80163a:	8b 7d 08             	mov    0x8(%ebp),%edi
  80163d:	8b 75 10             	mov    0x10(%ebp),%esi
	int m, tot;

	for (tot = 0; tot < n; tot += m) {
  801640:	bb 00 00 00 00       	mov    $0x0,%ebx
  801645:	eb 02                	jmp    801649 <readn+0x1c>
  801647:	01 c3                	add    %eax,%ebx
  801649:	39 f3                	cmp    %esi,%ebx
  80164b:	73 21                	jae    80166e <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80164d:	83 ec 04             	sub    $0x4,%esp
  801650:	89 f0                	mov    %esi,%eax
  801652:	29 d8                	sub    %ebx,%eax
  801654:	50                   	push   %eax
  801655:	89 d8                	mov    %ebx,%eax
  801657:	03 45 0c             	add    0xc(%ebp),%eax
  80165a:	50                   	push   %eax
  80165b:	57                   	push   %edi
  80165c:	e8 41 ff ff ff       	call   8015a2 <read>
		if (m < 0)
  801661:	83 c4 10             	add    $0x10,%esp
  801664:	85 c0                	test   %eax,%eax
  801666:	78 04                	js     80166c <readn+0x3f>
			return m;
		if (m == 0)
  801668:	75 dd                	jne    801647 <readn+0x1a>
  80166a:	eb 02                	jmp    80166e <readn+0x41>
		m = read(fdnum, (char*)buf + tot, n - tot);
  80166c:	89 c3                	mov    %eax,%ebx
			break;
	}
	return tot;
}
  80166e:	89 d8                	mov    %ebx,%eax
  801670:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801673:	5b                   	pop    %ebx
  801674:	5e                   	pop    %esi
  801675:	5f                   	pop    %edi
  801676:	5d                   	pop    %ebp
  801677:	c3                   	ret    

00801678 <write>:

ssize_t
write(int fdnum, const void *buf, size_t n)
{
  801678:	f3 0f 1e fb          	endbr32 
  80167c:	55                   	push   %ebp
  80167d:	89 e5                	mov    %esp,%ebp
  80167f:	53                   	push   %ebx
  801680:	83 ec 1c             	sub    $0x1c,%esp
  801683:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  801686:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801689:	50                   	push   %eax
  80168a:	53                   	push   %ebx
  80168b:	e8 8f fc ff ff       	call   80131f <fd_lookup>
  801690:	83 c4 10             	add    $0x10,%esp
  801693:	85 c0                	test   %eax,%eax
  801695:	78 3a                	js     8016d1 <write+0x59>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  801697:	83 ec 08             	sub    $0x8,%esp
  80169a:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80169d:	50                   	push   %eax
  80169e:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016a1:	ff 30                	pushl  (%eax)
  8016a3:	e8 cb fc ff ff       	call   801373 <dev_lookup>
  8016a8:	83 c4 10             	add    $0x10,%esp
  8016ab:	85 c0                	test   %eax,%eax
  8016ad:	78 22                	js     8016d1 <write+0x59>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  8016af:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8016b2:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  8016b6:	74 1e                	je     8016d6 <write+0x5e>
		return -E_INVAL;
	}
	if (debug)
		cprintf("write %d %p %d via dev %s\n",
			fdnum, buf, n, dev->dev_name);
	if (!dev->dev_write)
  8016b8:	8b 55 f4             	mov    -0xc(%ebp),%edx
  8016bb:	8b 52 0c             	mov    0xc(%edx),%edx
  8016be:	85 d2                	test   %edx,%edx
  8016c0:	74 35                	je     8016f7 <write+0x7f>
		return -E_NOT_SUPP;
	return (*dev->dev_write)(fd, buf, n);
  8016c2:	83 ec 04             	sub    $0x4,%esp
  8016c5:	ff 75 10             	pushl  0x10(%ebp)
  8016c8:	ff 75 0c             	pushl  0xc(%ebp)
  8016cb:	50                   	push   %eax
  8016cc:	ff d2                	call   *%edx
  8016ce:	83 c4 10             	add    $0x10,%esp
}
  8016d1:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  8016d4:	c9                   	leave  
  8016d5:	c3                   	ret    
		cprintf("[%08x] write %d -- bad mode\n", thisenv->env_id, fdnum);
  8016d6:	a1 04 40 80 00       	mov    0x804004,%eax
  8016db:	8b 40 48             	mov    0x48(%eax),%eax
  8016de:	83 ec 04             	sub    $0x4,%esp
  8016e1:	53                   	push   %ebx
  8016e2:	50                   	push   %eax
  8016e3:	68 19 2a 80 00       	push   $0x802a19
  8016e8:	e8 40 ec ff ff       	call   80032d <cprintf>
		return -E_INVAL;
  8016ed:	83 c4 10             	add    $0x10,%esp
  8016f0:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8016f5:	eb da                	jmp    8016d1 <write+0x59>
		return -E_NOT_SUPP;
  8016f7:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8016fc:	eb d3                	jmp    8016d1 <write+0x59>

008016fe <seek>:

int
seek(int fdnum, off_t offset)
{
  8016fe:	f3 0f 1e fb          	endbr32 
  801702:	55                   	push   %ebp
  801703:	89 e5                	mov    %esp,%ebp
  801705:	83 ec 20             	sub    $0x20,%esp
	int r;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801708:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80170b:	50                   	push   %eax
  80170c:	ff 75 08             	pushl  0x8(%ebp)
  80170f:	e8 0b fc ff ff       	call   80131f <fd_lookup>
  801714:	83 c4 10             	add    $0x10,%esp
  801717:	85 c0                	test   %eax,%eax
  801719:	78 0e                	js     801729 <seek+0x2b>
		return r;
	fd->fd_offset = offset;
  80171b:	8b 55 0c             	mov    0xc(%ebp),%edx
  80171e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801721:	89 50 04             	mov    %edx,0x4(%eax)
	return 0;
  801724:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801729:	c9                   	leave  
  80172a:	c3                   	ret    

0080172b <ftruncate>:

int
ftruncate(int fdnum, off_t newsize)
{
  80172b:	f3 0f 1e fb          	endbr32 
  80172f:	55                   	push   %ebp
  801730:	89 e5                	mov    %esp,%ebp
  801732:	53                   	push   %ebx
  801733:	83 ec 1c             	sub    $0x1c,%esp
  801736:	8b 5d 08             	mov    0x8(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;
	if ((r = fd_lookup(fdnum, &fd)) < 0
  801739:	8d 45 f0             	lea    -0x10(%ebp),%eax
  80173c:	50                   	push   %eax
  80173d:	53                   	push   %ebx
  80173e:	e8 dc fb ff ff       	call   80131f <fd_lookup>
  801743:	83 c4 10             	add    $0x10,%esp
  801746:	85 c0                	test   %eax,%eax
  801748:	78 37                	js     801781 <ftruncate+0x56>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  80174a:	83 ec 08             	sub    $0x8,%esp
  80174d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801750:	50                   	push   %eax
  801751:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801754:	ff 30                	pushl  (%eax)
  801756:	e8 18 fc ff ff       	call   801373 <dev_lookup>
  80175b:	83 c4 10             	add    $0x10,%esp
  80175e:	85 c0                	test   %eax,%eax
  801760:	78 1f                	js     801781 <ftruncate+0x56>
		return r;
	if ((fd->fd_omode & O_ACCMODE) == O_RDONLY) {
  801762:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801765:	f6 40 08 03          	testb  $0x3,0x8(%eax)
  801769:	74 1b                	je     801786 <ftruncate+0x5b>
		cprintf("[%08x] ftruncate %d -- bad mode\n",
			thisenv->env_id, fdnum);
		return -E_INVAL;
	}
	if (!dev->dev_trunc)
  80176b:	8b 55 f4             	mov    -0xc(%ebp),%edx
  80176e:	8b 52 18             	mov    0x18(%edx),%edx
  801771:	85 d2                	test   %edx,%edx
  801773:	74 32                	je     8017a7 <ftruncate+0x7c>
		return -E_NOT_SUPP;
	return (*dev->dev_trunc)(fd, newsize);
  801775:	83 ec 08             	sub    $0x8,%esp
  801778:	ff 75 0c             	pushl  0xc(%ebp)
  80177b:	50                   	push   %eax
  80177c:	ff d2                	call   *%edx
  80177e:	83 c4 10             	add    $0x10,%esp
}
  801781:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801784:	c9                   	leave  
  801785:	c3                   	ret    
			thisenv->env_id, fdnum);
  801786:	a1 04 40 80 00       	mov    0x804004,%eax
		cprintf("[%08x] ftruncate %d -- bad mode\n",
  80178b:	8b 40 48             	mov    0x48(%eax),%eax
  80178e:	83 ec 04             	sub    $0x4,%esp
  801791:	53                   	push   %ebx
  801792:	50                   	push   %eax
  801793:	68 dc 29 80 00       	push   $0x8029dc
  801798:	e8 90 eb ff ff       	call   80032d <cprintf>
		return -E_INVAL;
  80179d:	83 c4 10             	add    $0x10,%esp
  8017a0:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  8017a5:	eb da                	jmp    801781 <ftruncate+0x56>
		return -E_NOT_SUPP;
  8017a7:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  8017ac:	eb d3                	jmp    801781 <ftruncate+0x56>

008017ae <fstat>:

int
fstat(int fdnum, struct Stat *stat)
{
  8017ae:	f3 0f 1e fb          	endbr32 
  8017b2:	55                   	push   %ebp
  8017b3:	89 e5                	mov    %esp,%ebp
  8017b5:	53                   	push   %ebx
  8017b6:	83 ec 1c             	sub    $0x1c,%esp
  8017b9:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	int r;
	struct Dev *dev;
	struct Fd *fd;

	if ((r = fd_lookup(fdnum, &fd)) < 0
  8017bc:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8017bf:	50                   	push   %eax
  8017c0:	ff 75 08             	pushl  0x8(%ebp)
  8017c3:	e8 57 fb ff ff       	call   80131f <fd_lookup>
  8017c8:	83 c4 10             	add    $0x10,%esp
  8017cb:	85 c0                	test   %eax,%eax
  8017cd:	78 4b                	js     80181a <fstat+0x6c>
	    || (r = dev_lookup(fd->fd_dev_id, &dev)) < 0)
  8017cf:	83 ec 08             	sub    $0x8,%esp
  8017d2:	8d 45 f4             	lea    -0xc(%ebp),%eax
  8017d5:	50                   	push   %eax
  8017d6:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8017d9:	ff 30                	pushl  (%eax)
  8017db:	e8 93 fb ff ff       	call   801373 <dev_lookup>
  8017e0:	83 c4 10             	add    $0x10,%esp
  8017e3:	85 c0                	test   %eax,%eax
  8017e5:	78 33                	js     80181a <fstat+0x6c>
		return r;
	if (!dev->dev_stat)
  8017e7:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8017ea:	83 78 14 00          	cmpl   $0x0,0x14(%eax)
  8017ee:	74 2f                	je     80181f <fstat+0x71>
		return -E_NOT_SUPP;
	stat->st_name[0] = 0;
  8017f0:	c6 03 00             	movb   $0x0,(%ebx)
	stat->st_size = 0;
  8017f3:	c7 83 80 00 00 00 00 	movl   $0x0,0x80(%ebx)
  8017fa:	00 00 00 
	stat->st_isdir = 0;
  8017fd:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801804:	00 00 00 
	stat->st_dev = dev;
  801807:	89 83 88 00 00 00    	mov    %eax,0x88(%ebx)
	return (*dev->dev_stat)(fd, stat);
  80180d:	83 ec 08             	sub    $0x8,%esp
  801810:	53                   	push   %ebx
  801811:	ff 75 f0             	pushl  -0x10(%ebp)
  801814:	ff 50 14             	call   *0x14(%eax)
  801817:	83 c4 10             	add    $0x10,%esp
}
  80181a:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  80181d:	c9                   	leave  
  80181e:	c3                   	ret    
		return -E_NOT_SUPP;
  80181f:	b8 f1 ff ff ff       	mov    $0xfffffff1,%eax
  801824:	eb f4                	jmp    80181a <fstat+0x6c>

00801826 <stat>:

int
stat(const char *path, struct Stat *stat)
{
  801826:	f3 0f 1e fb          	endbr32 
  80182a:	55                   	push   %ebp
  80182b:	89 e5                	mov    %esp,%ebp
  80182d:	56                   	push   %esi
  80182e:	53                   	push   %ebx
	int fd, r;

	if ((fd = open(path, O_RDONLY)) < 0)
  80182f:	83 ec 08             	sub    $0x8,%esp
  801832:	6a 00                	push   $0x0
  801834:	ff 75 08             	pushl  0x8(%ebp)
  801837:	e8 fb 01 00 00       	call   801a37 <open>
  80183c:	89 c3                	mov    %eax,%ebx
  80183e:	83 c4 10             	add    $0x10,%esp
  801841:	85 c0                	test   %eax,%eax
  801843:	78 1b                	js     801860 <stat+0x3a>
		return fd;
	r = fstat(fd, stat);
  801845:	83 ec 08             	sub    $0x8,%esp
  801848:	ff 75 0c             	pushl  0xc(%ebp)
  80184b:	50                   	push   %eax
  80184c:	e8 5d ff ff ff       	call   8017ae <fstat>
  801851:	89 c6                	mov    %eax,%esi
	close(fd);
  801853:	89 1c 24             	mov    %ebx,(%esp)
  801856:	e8 fd fb ff ff       	call   801458 <close>
	return r;
  80185b:	83 c4 10             	add    $0x10,%esp
  80185e:	89 f3                	mov    %esi,%ebx
}
  801860:	89 d8                	mov    %ebx,%eax
  801862:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801865:	5b                   	pop    %ebx
  801866:	5e                   	pop    %esi
  801867:	5d                   	pop    %ebp
  801868:	c3                   	ret    

00801869 <fsipc>:
// type: request code, passed as the simple integer IPC value.
// dstva: virtual address at which to receive reply page, 0 if none.
// Returns result from the file server.
static int
fsipc(unsigned type, void *dstva)
{
  801869:	55                   	push   %ebp
  80186a:	89 e5                	mov    %esp,%ebp
  80186c:	56                   	push   %esi
  80186d:	53                   	push   %ebx
  80186e:	89 c6                	mov    %eax,%esi
  801870:	89 d3                	mov    %edx,%ebx
	static envid_t fsenv;
	if (fsenv == 0)
  801872:	83 3d 00 40 80 00 00 	cmpl   $0x0,0x804000
  801879:	74 27                	je     8018a2 <fsipc+0x39>
	static_assert(sizeof(fsipcbuf) == PGSIZE);

	if (debug)
		cprintf("[%08x] fsipc %d %08x\n", thisenv->env_id, type, *(uint32_t *)&fsipcbuf);

	ipc_send(fsenv, type, &fsipcbuf, PTE_P | PTE_W | PTE_U);
  80187b:	6a 07                	push   $0x7
  80187d:	68 00 50 80 00       	push   $0x805000
  801882:	56                   	push   %esi
  801883:	ff 35 00 40 80 00    	pushl  0x804000
  801889:	e8 73 08 00 00       	call   802101 <ipc_send>
	return ipc_recv(NULL, dstva, NULL);
  80188e:	83 c4 0c             	add    $0xc,%esp
  801891:	6a 00                	push   $0x0
  801893:	53                   	push   %ebx
  801894:	6a 00                	push   $0x0
  801896:	e8 e5 07 00 00       	call   802080 <ipc_recv>
}
  80189b:	8d 65 f8             	lea    -0x8(%ebp),%esp
  80189e:	5b                   	pop    %ebx
  80189f:	5e                   	pop    %esi
  8018a0:	5d                   	pop    %ebp
  8018a1:	c3                   	ret    
		fsenv = ipc_find_env(ENV_TYPE_FS);
  8018a2:	83 ec 0c             	sub    $0xc,%esp
  8018a5:	6a 01                	push   $0x1
  8018a7:	e8 ad 08 00 00       	call   802159 <ipc_find_env>
  8018ac:	a3 00 40 80 00       	mov    %eax,0x804000
  8018b1:	83 c4 10             	add    $0x10,%esp
  8018b4:	eb c5                	jmp    80187b <fsipc+0x12>

008018b6 <devfile_trunc>:
}

// Truncate or extend an open file to 'size' bytes
static int
devfile_trunc(struct Fd *fd, off_t newsize)
{
  8018b6:	f3 0f 1e fb          	endbr32 
  8018ba:	55                   	push   %ebp
  8018bb:	89 e5                	mov    %esp,%ebp
  8018bd:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.set_size.req_fileid = fd->fd_file.id;
  8018c0:	8b 45 08             	mov    0x8(%ebp),%eax
  8018c3:	8b 40 0c             	mov    0xc(%eax),%eax
  8018c6:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.set_size.req_size = newsize;
  8018cb:	8b 45 0c             	mov    0xc(%ebp),%eax
  8018ce:	a3 04 50 80 00       	mov    %eax,0x805004
	return fsipc(FSREQ_SET_SIZE, NULL);
  8018d3:	ba 00 00 00 00       	mov    $0x0,%edx
  8018d8:	b8 02 00 00 00       	mov    $0x2,%eax
  8018dd:	e8 87 ff ff ff       	call   801869 <fsipc>
}
  8018e2:	c9                   	leave  
  8018e3:	c3                   	ret    

008018e4 <devfile_flush>:
{
  8018e4:	f3 0f 1e fb          	endbr32 
  8018e8:	55                   	push   %ebp
  8018e9:	89 e5                	mov    %esp,%ebp
  8018eb:	83 ec 08             	sub    $0x8,%esp
	fsipcbuf.flush.req_fileid = fd->fd_file.id;
  8018ee:	8b 45 08             	mov    0x8(%ebp),%eax
  8018f1:	8b 40 0c             	mov    0xc(%eax),%eax
  8018f4:	a3 00 50 80 00       	mov    %eax,0x805000
	return fsipc(FSREQ_FLUSH, NULL);
  8018f9:	ba 00 00 00 00       	mov    $0x0,%edx
  8018fe:	b8 06 00 00 00       	mov    $0x6,%eax
  801903:	e8 61 ff ff ff       	call   801869 <fsipc>
}
  801908:	c9                   	leave  
  801909:	c3                   	ret    

0080190a <devfile_stat>:
{
  80190a:	f3 0f 1e fb          	endbr32 
  80190e:	55                   	push   %ebp
  80190f:	89 e5                	mov    %esp,%ebp
  801911:	53                   	push   %ebx
  801912:	83 ec 04             	sub    $0x4,%esp
  801915:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	fsipcbuf.stat.req_fileid = fd->fd_file.id;
  801918:	8b 45 08             	mov    0x8(%ebp),%eax
  80191b:	8b 40 0c             	mov    0xc(%eax),%eax
  80191e:	a3 00 50 80 00       	mov    %eax,0x805000
	if ((r = fsipc(FSREQ_STAT, NULL)) < 0)
  801923:	ba 00 00 00 00       	mov    $0x0,%edx
  801928:	b8 05 00 00 00       	mov    $0x5,%eax
  80192d:	e8 37 ff ff ff       	call   801869 <fsipc>
  801932:	85 c0                	test   %eax,%eax
  801934:	78 2c                	js     801962 <devfile_stat+0x58>
	strcpy(st->st_name, fsipcbuf.statRet.ret_name);
  801936:	83 ec 08             	sub    $0x8,%esp
  801939:	68 00 50 80 00       	push   $0x805000
  80193e:	53                   	push   %ebx
  80193f:	e8 c2 ef ff ff       	call   800906 <strcpy>
	st->st_size = fsipcbuf.statRet.ret_size;
  801944:	a1 80 50 80 00       	mov    0x805080,%eax
  801949:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	st->st_isdir = fsipcbuf.statRet.ret_isdir;
  80194f:	a1 84 50 80 00       	mov    0x805084,%eax
  801954:	89 83 84 00 00 00    	mov    %eax,0x84(%ebx)
	return 0;
  80195a:	83 c4 10             	add    $0x10,%esp
  80195d:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801962:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801965:	c9                   	leave  
  801966:	c3                   	ret    

00801967 <devfile_write>:
{
  801967:	f3 0f 1e fb          	endbr32 
  80196b:	55                   	push   %ebp
  80196c:	89 e5                	mov    %esp,%ebp
  80196e:	83 ec 0c             	sub    $0xc,%esp
  801971:	8b 45 10             	mov    0x10(%ebp),%eax
  801974:	3d f8 0f 00 00       	cmp    $0xff8,%eax
  801979:	ba f8 0f 00 00       	mov    $0xff8,%edx
  80197e:	0f 47 c2             	cmova  %edx,%eax
	fsipcbuf.write.req_fileid = fd->fd_file.id;
  801981:	8b 55 08             	mov    0x8(%ebp),%edx
  801984:	8b 52 0c             	mov    0xc(%edx),%edx
  801987:	89 15 00 50 80 00    	mov    %edx,0x805000
	fsipcbuf.write.req_n = n;
  80198d:	a3 04 50 80 00       	mov    %eax,0x805004
	memmove(fsipcbuf.write.req_buf, buf, n);
  801992:	50                   	push   %eax
  801993:	ff 75 0c             	pushl  0xc(%ebp)
  801996:	68 08 50 80 00       	push   $0x805008
  80199b:	e8 1c f1 ff ff       	call   800abc <memmove>
	return fsipc(FSREQ_WRITE, NULL);}
  8019a0:	ba 00 00 00 00       	mov    $0x0,%edx
  8019a5:	b8 04 00 00 00       	mov    $0x4,%eax
  8019aa:	e8 ba fe ff ff       	call   801869 <fsipc>
  8019af:	c9                   	leave  
  8019b0:	c3                   	ret    

008019b1 <devfile_read>:
{
  8019b1:	f3 0f 1e fb          	endbr32 
  8019b5:	55                   	push   %ebp
  8019b6:	89 e5                	mov    %esp,%ebp
  8019b8:	56                   	push   %esi
  8019b9:	53                   	push   %ebx
  8019ba:	8b 75 10             	mov    0x10(%ebp),%esi
	fsipcbuf.read.req_fileid = fd->fd_file.id;
  8019bd:	8b 45 08             	mov    0x8(%ebp),%eax
  8019c0:	8b 40 0c             	mov    0xc(%eax),%eax
  8019c3:	a3 00 50 80 00       	mov    %eax,0x805000
	fsipcbuf.read.req_n = n;
  8019c8:	89 35 04 50 80 00    	mov    %esi,0x805004
	if ((r = fsipc(FSREQ_READ, NULL)) < 0)
  8019ce:	ba 00 00 00 00       	mov    $0x0,%edx
  8019d3:	b8 03 00 00 00       	mov    $0x3,%eax
  8019d8:	e8 8c fe ff ff       	call   801869 <fsipc>
  8019dd:	89 c3                	mov    %eax,%ebx
  8019df:	85 c0                	test   %eax,%eax
  8019e1:	78 1f                	js     801a02 <devfile_read+0x51>
	assert(r <= n);
  8019e3:	39 f0                	cmp    %esi,%eax
  8019e5:	77 24                	ja     801a0b <devfile_read+0x5a>
	assert(r <= PGSIZE);
  8019e7:	3d 00 10 00 00       	cmp    $0x1000,%eax
  8019ec:	7f 33                	jg     801a21 <devfile_read+0x70>
	memmove(buf, fsipcbuf.readRet.ret_buf, r);
  8019ee:	83 ec 04             	sub    $0x4,%esp
  8019f1:	50                   	push   %eax
  8019f2:	68 00 50 80 00       	push   $0x805000
  8019f7:	ff 75 0c             	pushl  0xc(%ebp)
  8019fa:	e8 bd f0 ff ff       	call   800abc <memmove>
	return r;
  8019ff:	83 c4 10             	add    $0x10,%esp
}
  801a02:	89 d8                	mov    %ebx,%eax
  801a04:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801a07:	5b                   	pop    %ebx
  801a08:	5e                   	pop    %esi
  801a09:	5d                   	pop    %ebp
  801a0a:	c3                   	ret    
	assert(r <= n);
  801a0b:	68 48 2a 80 00       	push   $0x802a48
  801a10:	68 4f 2a 80 00       	push   $0x802a4f
  801a15:	6a 7c                	push   $0x7c
  801a17:	68 64 2a 80 00       	push   $0x802a64
  801a1c:	e8 25 e8 ff ff       	call   800246 <_panic>
	assert(r <= PGSIZE);
  801a21:	68 6f 2a 80 00       	push   $0x802a6f
  801a26:	68 4f 2a 80 00       	push   $0x802a4f
  801a2b:	6a 7d                	push   $0x7d
  801a2d:	68 64 2a 80 00       	push   $0x802a64
  801a32:	e8 0f e8 ff ff       	call   800246 <_panic>

00801a37 <open>:
{
  801a37:	f3 0f 1e fb          	endbr32 
  801a3b:	55                   	push   %ebp
  801a3c:	89 e5                	mov    %esp,%ebp
  801a3e:	56                   	push   %esi
  801a3f:	53                   	push   %ebx
  801a40:	83 ec 1c             	sub    $0x1c,%esp
  801a43:	8b 75 08             	mov    0x8(%ebp),%esi
	if (strlen(path) >= MAXPATHLEN)
  801a46:	56                   	push   %esi
  801a47:	e8 77 ee ff ff       	call   8008c3 <strlen>
  801a4c:	83 c4 10             	add    $0x10,%esp
  801a4f:	3d ff 03 00 00       	cmp    $0x3ff,%eax
  801a54:	7f 6c                	jg     801ac2 <open+0x8b>
	if ((r = fd_alloc(&fd)) < 0)
  801a56:	83 ec 0c             	sub    $0xc,%esp
  801a59:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801a5c:	50                   	push   %eax
  801a5d:	e8 67 f8 ff ff       	call   8012c9 <fd_alloc>
  801a62:	89 c3                	mov    %eax,%ebx
  801a64:	83 c4 10             	add    $0x10,%esp
  801a67:	85 c0                	test   %eax,%eax
  801a69:	78 3c                	js     801aa7 <open+0x70>
	strcpy(fsipcbuf.open.req_path, path);
  801a6b:	83 ec 08             	sub    $0x8,%esp
  801a6e:	56                   	push   %esi
  801a6f:	68 00 50 80 00       	push   $0x805000
  801a74:	e8 8d ee ff ff       	call   800906 <strcpy>
	fsipcbuf.open.req_omode = mode;
  801a79:	8b 45 0c             	mov    0xc(%ebp),%eax
  801a7c:	a3 00 54 80 00       	mov    %eax,0x805400
	if ((r = fsipc(FSREQ_OPEN, fd)) < 0) {
  801a81:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801a84:	b8 01 00 00 00       	mov    $0x1,%eax
  801a89:	e8 db fd ff ff       	call   801869 <fsipc>
  801a8e:	89 c3                	mov    %eax,%ebx
  801a90:	83 c4 10             	add    $0x10,%esp
  801a93:	85 c0                	test   %eax,%eax
  801a95:	78 19                	js     801ab0 <open+0x79>
	return fd2num(fd);
  801a97:	83 ec 0c             	sub    $0xc,%esp
  801a9a:	ff 75 f4             	pushl  -0xc(%ebp)
  801a9d:	e8 f8 f7 ff ff       	call   80129a <fd2num>
  801aa2:	89 c3                	mov    %eax,%ebx
  801aa4:	83 c4 10             	add    $0x10,%esp
}
  801aa7:	89 d8                	mov    %ebx,%eax
  801aa9:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801aac:	5b                   	pop    %ebx
  801aad:	5e                   	pop    %esi
  801aae:	5d                   	pop    %ebp
  801aaf:	c3                   	ret    
		fd_close(fd, 0);
  801ab0:	83 ec 08             	sub    $0x8,%esp
  801ab3:	6a 00                	push   $0x0
  801ab5:	ff 75 f4             	pushl  -0xc(%ebp)
  801ab8:	e8 10 f9 ff ff       	call   8013cd <fd_close>
		return r;
  801abd:	83 c4 10             	add    $0x10,%esp
  801ac0:	eb e5                	jmp    801aa7 <open+0x70>
		return -E_BAD_PATH;
  801ac2:	bb f4 ff ff ff       	mov    $0xfffffff4,%ebx
  801ac7:	eb de                	jmp    801aa7 <open+0x70>

00801ac9 <sync>:


// Synchronize disk with buffer cache
int
sync(void)
{
  801ac9:	f3 0f 1e fb          	endbr32 
  801acd:	55                   	push   %ebp
  801ace:	89 e5                	mov    %esp,%ebp
  801ad0:	83 ec 08             	sub    $0x8,%esp
	// Ask the file server to update the disk
	// by writing any dirty blocks in the buffer cache.

	return fsipc(FSREQ_SYNC, NULL);
  801ad3:	ba 00 00 00 00       	mov    $0x0,%edx
  801ad8:	b8 08 00 00 00       	mov    $0x8,%eax
  801add:	e8 87 fd ff ff       	call   801869 <fsipc>
}
  801ae2:	c9                   	leave  
  801ae3:	c3                   	ret    

00801ae4 <devpipe_stat>:
	return i;
}

static int
devpipe_stat(struct Fd *fd, struct Stat *stat)
{
  801ae4:	f3 0f 1e fb          	endbr32 
  801ae8:	55                   	push   %ebp
  801ae9:	89 e5                	mov    %esp,%ebp
  801aeb:	56                   	push   %esi
  801aec:	53                   	push   %ebx
  801aed:	8b 5d 0c             	mov    0xc(%ebp),%ebx
	struct Pipe *p = (struct Pipe*) fd2data(fd);
  801af0:	83 ec 0c             	sub    $0xc,%esp
  801af3:	ff 75 08             	pushl  0x8(%ebp)
  801af6:	e8 b3 f7 ff ff       	call   8012ae <fd2data>
  801afb:	89 c6                	mov    %eax,%esi
	strcpy(stat->st_name, "<pipe>");
  801afd:	83 c4 08             	add    $0x8,%esp
  801b00:	68 7b 2a 80 00       	push   $0x802a7b
  801b05:	53                   	push   %ebx
  801b06:	e8 fb ed ff ff       	call   800906 <strcpy>
	stat->st_size = p->p_wpos - p->p_rpos;
  801b0b:	8b 46 04             	mov    0x4(%esi),%eax
  801b0e:	2b 06                	sub    (%esi),%eax
  801b10:	89 83 80 00 00 00    	mov    %eax,0x80(%ebx)
	stat->st_isdir = 0;
  801b16:	c7 83 84 00 00 00 00 	movl   $0x0,0x84(%ebx)
  801b1d:	00 00 00 
	stat->st_dev = &devpipe;
  801b20:	c7 83 88 00 00 00 20 	movl   $0x803020,0x88(%ebx)
  801b27:	30 80 00 
	return 0;
}
  801b2a:	b8 00 00 00 00       	mov    $0x0,%eax
  801b2f:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801b32:	5b                   	pop    %ebx
  801b33:	5e                   	pop    %esi
  801b34:	5d                   	pop    %ebp
  801b35:	c3                   	ret    

00801b36 <devpipe_close>:

static int
devpipe_close(struct Fd *fd)
{
  801b36:	f3 0f 1e fb          	endbr32 
  801b3a:	55                   	push   %ebp
  801b3b:	89 e5                	mov    %esp,%ebp
  801b3d:	53                   	push   %ebx
  801b3e:	83 ec 0c             	sub    $0xc,%esp
  801b41:	8b 5d 08             	mov    0x8(%ebp),%ebx
	(void) sys_page_unmap(0, fd);
  801b44:	53                   	push   %ebx
  801b45:	6a 00                	push   $0x0
  801b47:	e8 89 f2 ff ff       	call   800dd5 <sys_page_unmap>
	return sys_page_unmap(0, fd2data(fd));
  801b4c:	89 1c 24             	mov    %ebx,(%esp)
  801b4f:	e8 5a f7 ff ff       	call   8012ae <fd2data>
  801b54:	83 c4 08             	add    $0x8,%esp
  801b57:	50                   	push   %eax
  801b58:	6a 00                	push   $0x0
  801b5a:	e8 76 f2 ff ff       	call   800dd5 <sys_page_unmap>
}
  801b5f:	8b 5d fc             	mov    -0x4(%ebp),%ebx
  801b62:	c9                   	leave  
  801b63:	c3                   	ret    

00801b64 <_pipeisclosed>:
{
  801b64:	55                   	push   %ebp
  801b65:	89 e5                	mov    %esp,%ebp
  801b67:	57                   	push   %edi
  801b68:	56                   	push   %esi
  801b69:	53                   	push   %ebx
  801b6a:	83 ec 1c             	sub    $0x1c,%esp
  801b6d:	89 c7                	mov    %eax,%edi
  801b6f:	89 d6                	mov    %edx,%esi
		n = thisenv->env_runs;
  801b71:	a1 04 40 80 00       	mov    0x804004,%eax
  801b76:	8b 58 58             	mov    0x58(%eax),%ebx
		ret = pageref(fd) == pageref(p);
  801b79:	83 ec 0c             	sub    $0xc,%esp
  801b7c:	57                   	push   %edi
  801b7d:	e8 14 06 00 00       	call   802196 <pageref>
  801b82:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  801b85:	89 34 24             	mov    %esi,(%esp)
  801b88:	e8 09 06 00 00       	call   802196 <pageref>
		nn = thisenv->env_runs;
  801b8d:	8b 15 04 40 80 00    	mov    0x804004,%edx
  801b93:	8b 4a 58             	mov    0x58(%edx),%ecx
		if (n == nn)
  801b96:	83 c4 10             	add    $0x10,%esp
  801b99:	39 cb                	cmp    %ecx,%ebx
  801b9b:	74 1b                	je     801bb8 <_pipeisclosed+0x54>
		if (n != nn && ret == 1)
  801b9d:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801ba0:	75 cf                	jne    801b71 <_pipeisclosed+0xd>
			cprintf("pipe race avoided\n", n, thisenv->env_runs, ret);
  801ba2:	8b 42 58             	mov    0x58(%edx),%eax
  801ba5:	6a 01                	push   $0x1
  801ba7:	50                   	push   %eax
  801ba8:	53                   	push   %ebx
  801ba9:	68 82 2a 80 00       	push   $0x802a82
  801bae:	e8 7a e7 ff ff       	call   80032d <cprintf>
  801bb3:	83 c4 10             	add    $0x10,%esp
  801bb6:	eb b9                	jmp    801b71 <_pipeisclosed+0xd>
		ret = pageref(fd) == pageref(p);
  801bb8:	39 45 e4             	cmp    %eax,-0x1c(%ebp)
  801bbb:	0f 94 c0             	sete   %al
  801bbe:	0f b6 c0             	movzbl %al,%eax
}
  801bc1:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801bc4:	5b                   	pop    %ebx
  801bc5:	5e                   	pop    %esi
  801bc6:	5f                   	pop    %edi
  801bc7:	5d                   	pop    %ebp
  801bc8:	c3                   	ret    

00801bc9 <devpipe_write>:
{
  801bc9:	f3 0f 1e fb          	endbr32 
  801bcd:	55                   	push   %ebp
  801bce:	89 e5                	mov    %esp,%ebp
  801bd0:	57                   	push   %edi
  801bd1:	56                   	push   %esi
  801bd2:	53                   	push   %ebx
  801bd3:	83 ec 28             	sub    $0x28,%esp
  801bd6:	8b 75 08             	mov    0x8(%ebp),%esi
	p = (struct Pipe*) fd2data(fd);
  801bd9:	56                   	push   %esi
  801bda:	e8 cf f6 ff ff       	call   8012ae <fd2data>
  801bdf:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801be1:	83 c4 10             	add    $0x10,%esp
  801be4:	bf 00 00 00 00       	mov    $0x0,%edi
  801be9:	3b 7d 10             	cmp    0x10(%ebp),%edi
  801bec:	74 4f                	je     801c3d <devpipe_write+0x74>
		while (p->p_wpos >= p->p_rpos + sizeof(p->p_buf)) {
  801bee:	8b 43 04             	mov    0x4(%ebx),%eax
  801bf1:	8b 0b                	mov    (%ebx),%ecx
  801bf3:	8d 51 20             	lea    0x20(%ecx),%edx
  801bf6:	39 d0                	cmp    %edx,%eax
  801bf8:	72 14                	jb     801c0e <devpipe_write+0x45>
			if (_pipeisclosed(fd, p))
  801bfa:	89 da                	mov    %ebx,%edx
  801bfc:	89 f0                	mov    %esi,%eax
  801bfe:	e8 61 ff ff ff       	call   801b64 <_pipeisclosed>
  801c03:	85 c0                	test   %eax,%eax
  801c05:	75 3b                	jne    801c42 <devpipe_write+0x79>
			sys_yield();
  801c07:	e8 19 f1 ff ff       	call   800d25 <sys_yield>
  801c0c:	eb e0                	jmp    801bee <devpipe_write+0x25>
		p->p_buf[p->p_wpos % PIPEBUFSIZ] = buf[i];
  801c0e:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801c11:	0f b6 0c 39          	movzbl (%ecx,%edi,1),%ecx
  801c15:	88 4d e7             	mov    %cl,-0x19(%ebp)
  801c18:	89 c2                	mov    %eax,%edx
  801c1a:	c1 fa 1f             	sar    $0x1f,%edx
  801c1d:	89 d1                	mov    %edx,%ecx
  801c1f:	c1 e9 1b             	shr    $0x1b,%ecx
  801c22:	8d 14 08             	lea    (%eax,%ecx,1),%edx
  801c25:	83 e2 1f             	and    $0x1f,%edx
  801c28:	29 ca                	sub    %ecx,%edx
  801c2a:	0f b6 4d e7          	movzbl -0x19(%ebp),%ecx
  801c2e:	88 4c 13 08          	mov    %cl,0x8(%ebx,%edx,1)
		p->p_wpos++;
  801c32:	83 c0 01             	add    $0x1,%eax
  801c35:	89 43 04             	mov    %eax,0x4(%ebx)
	for (i = 0; i < n; i++) {
  801c38:	83 c7 01             	add    $0x1,%edi
  801c3b:	eb ac                	jmp    801be9 <devpipe_write+0x20>
	return i;
  801c3d:	8b 45 10             	mov    0x10(%ebp),%eax
  801c40:	eb 05                	jmp    801c47 <devpipe_write+0x7e>
				return 0;
  801c42:	b8 00 00 00 00       	mov    $0x0,%eax
}
  801c47:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c4a:	5b                   	pop    %ebx
  801c4b:	5e                   	pop    %esi
  801c4c:	5f                   	pop    %edi
  801c4d:	5d                   	pop    %ebp
  801c4e:	c3                   	ret    

00801c4f <devpipe_read>:
{
  801c4f:	f3 0f 1e fb          	endbr32 
  801c53:	55                   	push   %ebp
  801c54:	89 e5                	mov    %esp,%ebp
  801c56:	57                   	push   %edi
  801c57:	56                   	push   %esi
  801c58:	53                   	push   %ebx
  801c59:	83 ec 18             	sub    $0x18,%esp
  801c5c:	8b 7d 08             	mov    0x8(%ebp),%edi
	p = (struct Pipe*)fd2data(fd);
  801c5f:	57                   	push   %edi
  801c60:	e8 49 f6 ff ff       	call   8012ae <fd2data>
  801c65:	89 c3                	mov    %eax,%ebx
	for (i = 0; i < n; i++) {
  801c67:	83 c4 10             	add    $0x10,%esp
  801c6a:	be 00 00 00 00       	mov    $0x0,%esi
  801c6f:	3b 75 10             	cmp    0x10(%ebp),%esi
  801c72:	75 14                	jne    801c88 <devpipe_read+0x39>
	return i;
  801c74:	8b 45 10             	mov    0x10(%ebp),%eax
  801c77:	eb 02                	jmp    801c7b <devpipe_read+0x2c>
				return i;
  801c79:	89 f0                	mov    %esi,%eax
}
  801c7b:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801c7e:	5b                   	pop    %ebx
  801c7f:	5e                   	pop    %esi
  801c80:	5f                   	pop    %edi
  801c81:	5d                   	pop    %ebp
  801c82:	c3                   	ret    
			sys_yield();
  801c83:	e8 9d f0 ff ff       	call   800d25 <sys_yield>
		while (p->p_rpos == p->p_wpos) {
  801c88:	8b 03                	mov    (%ebx),%eax
  801c8a:	3b 43 04             	cmp    0x4(%ebx),%eax
  801c8d:	75 18                	jne    801ca7 <devpipe_read+0x58>
			if (i > 0)
  801c8f:	85 f6                	test   %esi,%esi
  801c91:	75 e6                	jne    801c79 <devpipe_read+0x2a>
			if (_pipeisclosed(fd, p))
  801c93:	89 da                	mov    %ebx,%edx
  801c95:	89 f8                	mov    %edi,%eax
  801c97:	e8 c8 fe ff ff       	call   801b64 <_pipeisclosed>
  801c9c:	85 c0                	test   %eax,%eax
  801c9e:	74 e3                	je     801c83 <devpipe_read+0x34>
				return 0;
  801ca0:	b8 00 00 00 00       	mov    $0x0,%eax
  801ca5:	eb d4                	jmp    801c7b <devpipe_read+0x2c>
		buf[i] = p->p_buf[p->p_rpos % PIPEBUFSIZ];
  801ca7:	99                   	cltd   
  801ca8:	c1 ea 1b             	shr    $0x1b,%edx
  801cab:	01 d0                	add    %edx,%eax
  801cad:	83 e0 1f             	and    $0x1f,%eax
  801cb0:	29 d0                	sub    %edx,%eax
  801cb2:	0f b6 44 03 08       	movzbl 0x8(%ebx,%eax,1),%eax
  801cb7:	8b 4d 0c             	mov    0xc(%ebp),%ecx
  801cba:	88 04 31             	mov    %al,(%ecx,%esi,1)
		p->p_rpos++;
  801cbd:	83 03 01             	addl   $0x1,(%ebx)
	for (i = 0; i < n; i++) {
  801cc0:	83 c6 01             	add    $0x1,%esi
  801cc3:	eb aa                	jmp    801c6f <devpipe_read+0x20>

00801cc5 <pipe>:
{
  801cc5:	f3 0f 1e fb          	endbr32 
  801cc9:	55                   	push   %ebp
  801cca:	89 e5                	mov    %esp,%ebp
  801ccc:	56                   	push   %esi
  801ccd:	53                   	push   %ebx
  801cce:	83 ec 1c             	sub    $0x1c,%esp
	if ((r = fd_alloc(&fd0)) < 0
  801cd1:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801cd4:	50                   	push   %eax
  801cd5:	e8 ef f5 ff ff       	call   8012c9 <fd_alloc>
  801cda:	89 c3                	mov    %eax,%ebx
  801cdc:	83 c4 10             	add    $0x10,%esp
  801cdf:	85 c0                	test   %eax,%eax
  801ce1:	0f 88 23 01 00 00    	js     801e0a <pipe+0x145>
	    || (r = sys_page_alloc(0, fd0, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801ce7:	83 ec 04             	sub    $0x4,%esp
  801cea:	68 07 04 00 00       	push   $0x407
  801cef:	ff 75 f4             	pushl  -0xc(%ebp)
  801cf2:	6a 00                	push   $0x0
  801cf4:	e8 4f f0 ff ff       	call   800d48 <sys_page_alloc>
  801cf9:	89 c3                	mov    %eax,%ebx
  801cfb:	83 c4 10             	add    $0x10,%esp
  801cfe:	85 c0                	test   %eax,%eax
  801d00:	0f 88 04 01 00 00    	js     801e0a <pipe+0x145>
	if ((r = fd_alloc(&fd1)) < 0
  801d06:	83 ec 0c             	sub    $0xc,%esp
  801d09:	8d 45 f0             	lea    -0x10(%ebp),%eax
  801d0c:	50                   	push   %eax
  801d0d:	e8 b7 f5 ff ff       	call   8012c9 <fd_alloc>
  801d12:	89 c3                	mov    %eax,%ebx
  801d14:	83 c4 10             	add    $0x10,%esp
  801d17:	85 c0                	test   %eax,%eax
  801d19:	0f 88 db 00 00 00    	js     801dfa <pipe+0x135>
	    || (r = sys_page_alloc(0, fd1, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d1f:	83 ec 04             	sub    $0x4,%esp
  801d22:	68 07 04 00 00       	push   $0x407
  801d27:	ff 75 f0             	pushl  -0x10(%ebp)
  801d2a:	6a 00                	push   $0x0
  801d2c:	e8 17 f0 ff ff       	call   800d48 <sys_page_alloc>
  801d31:	89 c3                	mov    %eax,%ebx
  801d33:	83 c4 10             	add    $0x10,%esp
  801d36:	85 c0                	test   %eax,%eax
  801d38:	0f 88 bc 00 00 00    	js     801dfa <pipe+0x135>
	va = fd2data(fd0);
  801d3e:	83 ec 0c             	sub    $0xc,%esp
  801d41:	ff 75 f4             	pushl  -0xc(%ebp)
  801d44:	e8 65 f5 ff ff       	call   8012ae <fd2data>
  801d49:	89 c6                	mov    %eax,%esi
	if ((r = sys_page_alloc(0, va, PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d4b:	83 c4 0c             	add    $0xc,%esp
  801d4e:	68 07 04 00 00       	push   $0x407
  801d53:	50                   	push   %eax
  801d54:	6a 00                	push   $0x0
  801d56:	e8 ed ef ff ff       	call   800d48 <sys_page_alloc>
  801d5b:	89 c3                	mov    %eax,%ebx
  801d5d:	83 c4 10             	add    $0x10,%esp
  801d60:	85 c0                	test   %eax,%eax
  801d62:	0f 88 82 00 00 00    	js     801dea <pipe+0x125>
	if ((r = sys_page_map(0, va, 0, fd2data(fd1), PTE_P|PTE_W|PTE_U|PTE_SHARE)) < 0)
  801d68:	83 ec 0c             	sub    $0xc,%esp
  801d6b:	ff 75 f0             	pushl  -0x10(%ebp)
  801d6e:	e8 3b f5 ff ff       	call   8012ae <fd2data>
  801d73:	c7 04 24 07 04 00 00 	movl   $0x407,(%esp)
  801d7a:	50                   	push   %eax
  801d7b:	6a 00                	push   $0x0
  801d7d:	56                   	push   %esi
  801d7e:	6a 00                	push   $0x0
  801d80:	e8 0a f0 ff ff       	call   800d8f <sys_page_map>
  801d85:	89 c3                	mov    %eax,%ebx
  801d87:	83 c4 20             	add    $0x20,%esp
  801d8a:	85 c0                	test   %eax,%eax
  801d8c:	78 4e                	js     801ddc <pipe+0x117>
	fd0->fd_dev_id = devpipe.dev_id;
  801d8e:	a1 20 30 80 00       	mov    0x803020,%eax
  801d93:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d96:	89 02                	mov    %eax,(%edx)
	fd0->fd_omode = O_RDONLY;
  801d98:	8b 55 f4             	mov    -0xc(%ebp),%edx
  801d9b:	c7 42 08 00 00 00 00 	movl   $0x0,0x8(%edx)
	fd1->fd_dev_id = devpipe.dev_id;
  801da2:	8b 55 f0             	mov    -0x10(%ebp),%edx
  801da5:	89 02                	mov    %eax,(%edx)
	fd1->fd_omode = O_WRONLY;
  801da7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  801daa:	c7 40 08 01 00 00 00 	movl   $0x1,0x8(%eax)
	pfd[0] = fd2num(fd0);
  801db1:	83 ec 0c             	sub    $0xc,%esp
  801db4:	ff 75 f4             	pushl  -0xc(%ebp)
  801db7:	e8 de f4 ff ff       	call   80129a <fd2num>
  801dbc:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801dbf:	89 01                	mov    %eax,(%ecx)
	pfd[1] = fd2num(fd1);
  801dc1:	83 c4 04             	add    $0x4,%esp
  801dc4:	ff 75 f0             	pushl  -0x10(%ebp)
  801dc7:	e8 ce f4 ff ff       	call   80129a <fd2num>
  801dcc:	8b 4d 08             	mov    0x8(%ebp),%ecx
  801dcf:	89 41 04             	mov    %eax,0x4(%ecx)
	return 0;
  801dd2:	83 c4 10             	add    $0x10,%esp
  801dd5:	bb 00 00 00 00       	mov    $0x0,%ebx
  801dda:	eb 2e                	jmp    801e0a <pipe+0x145>
	sys_page_unmap(0, va);
  801ddc:	83 ec 08             	sub    $0x8,%esp
  801ddf:	56                   	push   %esi
  801de0:	6a 00                	push   $0x0
  801de2:	e8 ee ef ff ff       	call   800dd5 <sys_page_unmap>
  801de7:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd1);
  801dea:	83 ec 08             	sub    $0x8,%esp
  801ded:	ff 75 f0             	pushl  -0x10(%ebp)
  801df0:	6a 00                	push   $0x0
  801df2:	e8 de ef ff ff       	call   800dd5 <sys_page_unmap>
  801df7:	83 c4 10             	add    $0x10,%esp
	sys_page_unmap(0, fd0);
  801dfa:	83 ec 08             	sub    $0x8,%esp
  801dfd:	ff 75 f4             	pushl  -0xc(%ebp)
  801e00:	6a 00                	push   $0x0
  801e02:	e8 ce ef ff ff       	call   800dd5 <sys_page_unmap>
  801e07:	83 c4 10             	add    $0x10,%esp
}
  801e0a:	89 d8                	mov    %ebx,%eax
  801e0c:	8d 65 f8             	lea    -0x8(%ebp),%esp
  801e0f:	5b                   	pop    %ebx
  801e10:	5e                   	pop    %esi
  801e11:	5d                   	pop    %ebp
  801e12:	c3                   	ret    

00801e13 <pipeisclosed>:
{
  801e13:	f3 0f 1e fb          	endbr32 
  801e17:	55                   	push   %ebp
  801e18:	89 e5                	mov    %esp,%ebp
  801e1a:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801e1d:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801e20:	50                   	push   %eax
  801e21:	ff 75 08             	pushl  0x8(%ebp)
  801e24:	e8 f6 f4 ff ff       	call   80131f <fd_lookup>
  801e29:	83 c4 10             	add    $0x10,%esp
  801e2c:	85 c0                	test   %eax,%eax
  801e2e:	78 18                	js     801e48 <pipeisclosed+0x35>
	p = (struct Pipe*) fd2data(fd);
  801e30:	83 ec 0c             	sub    $0xc,%esp
  801e33:	ff 75 f4             	pushl  -0xc(%ebp)
  801e36:	e8 73 f4 ff ff       	call   8012ae <fd2data>
  801e3b:	89 c2                	mov    %eax,%edx
	return _pipeisclosed(fd, p);
  801e3d:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801e40:	e8 1f fd ff ff       	call   801b64 <_pipeisclosed>
  801e45:	83 c4 10             	add    $0x10,%esp
}
  801e48:	c9                   	leave  
  801e49:	c3                   	ret    

00801e4a <devcons_close>:
	return tot;
}

static int
devcons_close(struct Fd *fd)
{
  801e4a:	f3 0f 1e fb          	endbr32 
	USED(fd);

	return 0;
}
  801e4e:	b8 00 00 00 00       	mov    $0x0,%eax
  801e53:	c3                   	ret    

00801e54 <devcons_stat>:

static int
devcons_stat(struct Fd *fd, struct Stat *stat)
{
  801e54:	f3 0f 1e fb          	endbr32 
  801e58:	55                   	push   %ebp
  801e59:	89 e5                	mov    %esp,%ebp
  801e5b:	83 ec 10             	sub    $0x10,%esp
	strcpy(stat->st_name, "<cons>");
  801e5e:	68 9a 2a 80 00       	push   $0x802a9a
  801e63:	ff 75 0c             	pushl  0xc(%ebp)
  801e66:	e8 9b ea ff ff       	call   800906 <strcpy>
	return 0;
}
  801e6b:	b8 00 00 00 00       	mov    $0x0,%eax
  801e70:	c9                   	leave  
  801e71:	c3                   	ret    

00801e72 <devcons_write>:
{
  801e72:	f3 0f 1e fb          	endbr32 
  801e76:	55                   	push   %ebp
  801e77:	89 e5                	mov    %esp,%ebp
  801e79:	57                   	push   %edi
  801e7a:	56                   	push   %esi
  801e7b:	53                   	push   %ebx
  801e7c:	81 ec 8c 00 00 00    	sub    $0x8c,%esp
	for (tot = 0; tot < n; tot += m) {
  801e82:	be 00 00 00 00       	mov    $0x0,%esi
		memmove(buf, (char*)vbuf + tot, m);
  801e87:	8d bd 68 ff ff ff    	lea    -0x98(%ebp),%edi
	for (tot = 0; tot < n; tot += m) {
  801e8d:	3b 75 10             	cmp    0x10(%ebp),%esi
  801e90:	73 31                	jae    801ec3 <devcons_write+0x51>
		m = n - tot;
  801e92:	8b 5d 10             	mov    0x10(%ebp),%ebx
  801e95:	29 f3                	sub    %esi,%ebx
  801e97:	83 fb 7f             	cmp    $0x7f,%ebx
  801e9a:	b8 7f 00 00 00       	mov    $0x7f,%eax
  801e9f:	0f 47 d8             	cmova  %eax,%ebx
		memmove(buf, (char*)vbuf + tot, m);
  801ea2:	83 ec 04             	sub    $0x4,%esp
  801ea5:	53                   	push   %ebx
  801ea6:	89 f0                	mov    %esi,%eax
  801ea8:	03 45 0c             	add    0xc(%ebp),%eax
  801eab:	50                   	push   %eax
  801eac:	57                   	push   %edi
  801ead:	e8 0a ec ff ff       	call   800abc <memmove>
		sys_cputs(buf, m);
  801eb2:	83 c4 08             	add    $0x8,%esp
  801eb5:	53                   	push   %ebx
  801eb6:	57                   	push   %edi
  801eb7:	e8 bc ed ff ff       	call   800c78 <sys_cputs>
	for (tot = 0; tot < n; tot += m) {
  801ebc:	01 de                	add    %ebx,%esi
  801ebe:	83 c4 10             	add    $0x10,%esp
  801ec1:	eb ca                	jmp    801e8d <devcons_write+0x1b>
}
  801ec3:	89 f0                	mov    %esi,%eax
  801ec5:	8d 65 f4             	lea    -0xc(%ebp),%esp
  801ec8:	5b                   	pop    %ebx
  801ec9:	5e                   	pop    %esi
  801eca:	5f                   	pop    %edi
  801ecb:	5d                   	pop    %ebp
  801ecc:	c3                   	ret    

00801ecd <devcons_read>:
{
  801ecd:	f3 0f 1e fb          	endbr32 
  801ed1:	55                   	push   %ebp
  801ed2:	89 e5                	mov    %esp,%ebp
  801ed4:	83 ec 08             	sub    $0x8,%esp
  801ed7:	b8 00 00 00 00       	mov    $0x0,%eax
	if (n == 0)
  801edc:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  801ee0:	74 21                	je     801f03 <devcons_read+0x36>
	while ((c = sys_cgetc()) == 0)
  801ee2:	e8 b3 ed ff ff       	call   800c9a <sys_cgetc>
  801ee7:	85 c0                	test   %eax,%eax
  801ee9:	75 07                	jne    801ef2 <devcons_read+0x25>
		sys_yield();
  801eeb:	e8 35 ee ff ff       	call   800d25 <sys_yield>
  801ef0:	eb f0                	jmp    801ee2 <devcons_read+0x15>
	if (c < 0)
  801ef2:	78 0f                	js     801f03 <devcons_read+0x36>
	if (c == 0x04)	// ctl-d is eof
  801ef4:	83 f8 04             	cmp    $0x4,%eax
  801ef7:	74 0c                	je     801f05 <devcons_read+0x38>
	*(char*)vbuf = c;
  801ef9:	8b 55 0c             	mov    0xc(%ebp),%edx
  801efc:	88 02                	mov    %al,(%edx)
	return 1;
  801efe:	b8 01 00 00 00       	mov    $0x1,%eax
}
  801f03:	c9                   	leave  
  801f04:	c3                   	ret    
		return 0;
  801f05:	b8 00 00 00 00       	mov    $0x0,%eax
  801f0a:	eb f7                	jmp    801f03 <devcons_read+0x36>

00801f0c <cputchar>:
{
  801f0c:	f3 0f 1e fb          	endbr32 
  801f10:	55                   	push   %ebp
  801f11:	89 e5                	mov    %esp,%ebp
  801f13:	83 ec 20             	sub    $0x20,%esp
	char c = ch;
  801f16:	8b 45 08             	mov    0x8(%ebp),%eax
  801f19:	88 45 f7             	mov    %al,-0x9(%ebp)
	sys_cputs(&c, 1);
  801f1c:	6a 01                	push   $0x1
  801f1e:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f21:	50                   	push   %eax
  801f22:	e8 51 ed ff ff       	call   800c78 <sys_cputs>
}
  801f27:	83 c4 10             	add    $0x10,%esp
  801f2a:	c9                   	leave  
  801f2b:	c3                   	ret    

00801f2c <getchar>:
{
  801f2c:	f3 0f 1e fb          	endbr32 
  801f30:	55                   	push   %ebp
  801f31:	89 e5                	mov    %esp,%ebp
  801f33:	83 ec 1c             	sub    $0x1c,%esp
	r = read(0, &c, 1);
  801f36:	6a 01                	push   $0x1
  801f38:	8d 45 f7             	lea    -0x9(%ebp),%eax
  801f3b:	50                   	push   %eax
  801f3c:	6a 00                	push   $0x0
  801f3e:	e8 5f f6 ff ff       	call   8015a2 <read>
	if (r < 0)
  801f43:	83 c4 10             	add    $0x10,%esp
  801f46:	85 c0                	test   %eax,%eax
  801f48:	78 06                	js     801f50 <getchar+0x24>
	if (r < 1)
  801f4a:	74 06                	je     801f52 <getchar+0x26>
	return c;
  801f4c:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
}
  801f50:	c9                   	leave  
  801f51:	c3                   	ret    
		return -E_EOF;
  801f52:	b8 f8 ff ff ff       	mov    $0xfffffff8,%eax
  801f57:	eb f7                	jmp    801f50 <getchar+0x24>

00801f59 <iscons>:
{
  801f59:	f3 0f 1e fb          	endbr32 
  801f5d:	55                   	push   %ebp
  801f5e:	89 e5                	mov    %esp,%ebp
  801f60:	83 ec 20             	sub    $0x20,%esp
	if ((r = fd_lookup(fdnum, &fd)) < 0)
  801f63:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f66:	50                   	push   %eax
  801f67:	ff 75 08             	pushl  0x8(%ebp)
  801f6a:	e8 b0 f3 ff ff       	call   80131f <fd_lookup>
  801f6f:	83 c4 10             	add    $0x10,%esp
  801f72:	85 c0                	test   %eax,%eax
  801f74:	78 11                	js     801f87 <iscons+0x2e>
	return fd->fd_dev_id == devcons.dev_id;
  801f76:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801f79:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801f7f:	39 10                	cmp    %edx,(%eax)
  801f81:	0f 94 c0             	sete   %al
  801f84:	0f b6 c0             	movzbl %al,%eax
}
  801f87:	c9                   	leave  
  801f88:	c3                   	ret    

00801f89 <opencons>:
{
  801f89:	f3 0f 1e fb          	endbr32 
  801f8d:	55                   	push   %ebp
  801f8e:	89 e5                	mov    %esp,%ebp
  801f90:	83 ec 24             	sub    $0x24,%esp
	if ((r = fd_alloc(&fd)) < 0)
  801f93:	8d 45 f4             	lea    -0xc(%ebp),%eax
  801f96:	50                   	push   %eax
  801f97:	e8 2d f3 ff ff       	call   8012c9 <fd_alloc>
  801f9c:	83 c4 10             	add    $0x10,%esp
  801f9f:	85 c0                	test   %eax,%eax
  801fa1:	78 3a                	js     801fdd <opencons+0x54>
	if ((r = sys_page_alloc(0, fd, PTE_P|PTE_U|PTE_W|PTE_SHARE)) < 0)
  801fa3:	83 ec 04             	sub    $0x4,%esp
  801fa6:	68 07 04 00 00       	push   $0x407
  801fab:	ff 75 f4             	pushl  -0xc(%ebp)
  801fae:	6a 00                	push   $0x0
  801fb0:	e8 93 ed ff ff       	call   800d48 <sys_page_alloc>
  801fb5:	83 c4 10             	add    $0x10,%esp
  801fb8:	85 c0                	test   %eax,%eax
  801fba:	78 21                	js     801fdd <opencons+0x54>
	fd->fd_dev_id = devcons.dev_id;
  801fbc:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fbf:	8b 15 3c 30 80 00    	mov    0x80303c,%edx
  801fc5:	89 10                	mov    %edx,(%eax)
	fd->fd_omode = O_RDWR;
  801fc7:	8b 45 f4             	mov    -0xc(%ebp),%eax
  801fca:	c7 40 08 02 00 00 00 	movl   $0x2,0x8(%eax)
	return fd2num(fd);
  801fd1:	83 ec 0c             	sub    $0xc,%esp
  801fd4:	50                   	push   %eax
  801fd5:	e8 c0 f2 ff ff       	call   80129a <fd2num>
  801fda:	83 c4 10             	add    $0x10,%esp
}
  801fdd:	c9                   	leave  
  801fde:	c3                   	ret    

00801fdf <set_pgfault_handler>:
// at UXSTACKTOP), and tell the kernel to call the assembly-language
// _pgfault_upcall routine when a page fault occurs.
//
void
set_pgfault_handler(void (*handler)(struct UTrapframe *utf))
{
  801fdf:	f3 0f 1e fb          	endbr32 
  801fe3:	55                   	push   %ebp
  801fe4:	89 e5                	mov    %esp,%ebp
  801fe6:	83 ec 08             	sub    $0x8,%esp
	int r;

	if (_pgfault_handler == 0) {
  801fe9:	83 3d 00 60 80 00 00 	cmpl   $0x0,0x806000
  801ff0:	74 27                	je     802019 <set_pgfault_handler+0x3a>
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
			panic("set_pgfault_handler:sys_page_alloc failed");
	}

	// Save handler pointer for assembly to call.
	_pgfault_handler = handler;
  801ff2:	8b 45 08             	mov    0x8(%ebp),%eax
  801ff5:	a3 00 60 80 00       	mov    %eax,0x806000
	if (sys_env_set_pgfault_upcall(thisenv->env_id,_pgfault_upcall)<0)	
  801ffa:	a1 04 40 80 00       	mov    0x804004,%eax
  801fff:	8b 40 48             	mov    0x48(%eax),%eax
  802002:	83 ec 08             	sub    $0x8,%esp
  802005:	68 59 20 80 00       	push   $0x802059
  80200a:	50                   	push   %eax
  80200b:	e8 97 ee ff ff       	call   800ea7 <sys_env_set_pgfault_upcall>
  802010:	83 c4 10             	add    $0x10,%esp
  802013:	85 c0                	test   %eax,%eax
  802015:	78 2e                	js     802045 <set_pgfault_handler+0x66>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
}
  802017:	c9                   	leave  
  802018:	c3                   	ret    
		if(sys_page_alloc(0,(void *)UXSTACKTOP-PGSIZE,PTE_W|PTE_U|PTE_P)<0)
  802019:	83 ec 04             	sub    $0x4,%esp
  80201c:	6a 07                	push   $0x7
  80201e:	68 00 f0 bf ee       	push   $0xeebff000
  802023:	6a 00                	push   $0x0
  802025:	e8 1e ed ff ff       	call   800d48 <sys_page_alloc>
  80202a:	83 c4 10             	add    $0x10,%esp
  80202d:	85 c0                	test   %eax,%eax
  80202f:	79 c1                	jns    801ff2 <set_pgfault_handler+0x13>
			panic("set_pgfault_handler:sys_page_alloc failed");
  802031:	83 ec 04             	sub    $0x4,%esp
  802034:	68 a8 2a 80 00       	push   $0x802aa8
  802039:	6a 21                	push   $0x21
  80203b:	68 0a 2b 80 00       	push   $0x802b0a
  802040:	e8 01 e2 ff ff       	call   800246 <_panic>
        panic("set_pgfault_handler:sys_env_set_pgfault_upcall failed");
  802045:	83 ec 04             	sub    $0x4,%esp
  802048:	68 d4 2a 80 00       	push   $0x802ad4
  80204d:	6a 27                	push   $0x27
  80204f:	68 0a 2b 80 00       	push   $0x802b0a
  802054:	e8 ed e1 ff ff       	call   800246 <_panic>

00802059 <_pgfault_upcall>:

.text
.globl _pgfault_upcall
_pgfault_upcall:
	// Call the C page fault handler.
	pushl %esp			// function argument: pointer to UTF
  802059:	54                   	push   %esp
	movl _pgfault_handler, %eax
  80205a:	a1 00 60 80 00       	mov    0x806000,%eax
	call *%eax
  80205f:	ff d0                	call   *%eax
	addl $4, %esp			// pop function argument
  802061:	83 c4 04             	add    $0x4,%esp
	// may find that you have to rearrange your code in non-obvious
	// ways as registers become unavailable as scratch space.
	//
	// LAB 4: Your code here.
	//首先把此时的eip指针下移48个字节因为UTrapFrame的大小是48个字节
	movl 48(%esp), %ebp
  802064:	8b 6c 24 30          	mov    0x30(%esp),%ebp
    subl $4, %ebp		// UTrapFrame.utf_esp - 4 and store back 这里是由于之前预留了4个字节。
  802068:	83 ed 04             	sub    $0x4,%ebp
    movl %ebp, 48(%esp)	// 返回上一次的esp位置。
  80206b:	89 6c 24 30          	mov    %ebp,0x30(%esp)

	// Restore the trap-time registers.  After you do this, you
	// can no longer modify any general-purpose registers.
	// LAB 4: Your code here.
	movl 40(%esp), %eax 
  80206f:	8b 44 24 28          	mov    0x28(%esp),%eax
    movl %eax, (%ebp)
  802073:	89 45 00             	mov    %eax,0x0(%ebp)

	// Restore eflags from the stack.  After you do this, you can
	// no longer use arithmetic operations or anything else that
	// modifies eflags.
	// LAB 4: Your code here.
	addl $0x8, %esp         // Set %esp to the end of struct PushRegs
  802076:	83 c4 08             	add    $0x8,%esp
	popal                   // Restore the trap-time registers.(struct PushRegs)
  802079:	61                   	popa   

	// Switch back to the adjusted trap-time stack.
	// LAB 4: Your code here.
	addl $0x4, %esp         // now we are located at trap-time eip,so we have to increment %esp with 4.【跳过eip】
  80207a:	83 c4 04             	add    $0x4,%esp
	popfl                   // Restore eflags register.	【pop eflags】
  80207d:	9d                   	popf   
	popl %esp               // Just restore the adjusted trap-time stack pointer.
  80207e:	5c                   	pop    %esp
							// 恢复esp

	// Return to re-execute the instruction that faulted.
	// LAB 4: Your code here.
	ret                     // We are now on the trap-time stack,since we have saved trap-time eip above trap-time esp,ret instruction will pop this trap-time eip to register %eip which known as PC at this time.Thus,we can return to re-execute the instruction that faulted.
  80207f:	c3                   	ret    

00802080 <ipc_recv>:
//   If 'pg' is null, pass sys_ipc_recv a value that it will understand
//   as meaning "no page".  (Zero is not the right value, since that's
//   a perfectly valid place to map a page.)
int32_t
ipc_recv(envid_t *from_env_store, void *pg, int *perm_store)
{
  802080:	f3 0f 1e fb          	endbr32 
  802084:	55                   	push   %ebp
  802085:	89 e5                	mov    %esp,%ebp
  802087:	56                   	push   %esi
  802088:	53                   	push   %ebx
  802089:	8b 75 08             	mov    0x8(%ebp),%esi
  80208c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80208f:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	int error;
	if(!pg)pg = (void *)UTOP; // 如果设置为UTOP，这个值其实可以比UTOP大，设置为这个值认为pg无效了，不会进行页面传递【共享页面的设置】，而是只进行值value的传递。
  802092:	85 c0                	test   %eax,%eax
  802094:	ba 00 00 c0 ee       	mov    $0xeec00000,%edx
  802099:	0f 44 c2             	cmove  %edx,%eax
	if((error = sys_ipc_recv(pg)) < 0){
  80209c:	83 ec 0c             	sub    $0xc,%esp
  80209f:	50                   	push   %eax
  8020a0:	e8 6f ee ff ff       	call   800f14 <sys_ipc_recv>
  8020a5:	83 c4 10             	add    $0x10,%esp
  8020a8:	85 c0                	test   %eax,%eax
  8020aa:	78 3f                	js     8020eb <ipc_recv+0x6b>
		if(from_env_store)*from_env_store = 0;
		if(perm_store)*perm_store = 0;
		return error;
	}

	thisenv = &envs[ENVX(sys_getenvid())]; // for lab4's challenge sfork().
  8020ac:	e8 51 ec ff ff       	call   800d02 <sys_getenvid>
  8020b1:	25 ff 03 00 00       	and    $0x3ff,%eax
  8020b6:	6b d0 7c             	imul   $0x7c,%eax,%edx
  8020b9:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  8020bf:	89 15 04 40 80 00    	mov    %edx,0x804004

	if(from_env_store)*from_env_store = thisenv->env_ipc_from;
  8020c5:	85 f6                	test   %esi,%esi
  8020c7:	74 05                	je     8020ce <ipc_recv+0x4e>
  8020c9:	8b 42 74             	mov    0x74(%edx),%eax
  8020cc:	89 06                	mov    %eax,(%esi)
	if(perm_store)*perm_store = thisenv->env_ipc_perm;
  8020ce:	85 db                	test   %ebx,%ebx
  8020d0:	74 0a                	je     8020dc <ipc_recv+0x5c>
  8020d2:	a1 04 40 80 00       	mov    0x804004,%eax
  8020d7:	8b 40 78             	mov    0x78(%eax),%eax
  8020da:	89 03                	mov    %eax,(%ebx)
	return thisenv->env_ipc_value;
  8020dc:	a1 04 40 80 00       	mov    0x804004,%eax
  8020e1:	8b 40 70             	mov    0x70(%eax),%eax
}
  8020e4:	8d 65 f8             	lea    -0x8(%ebp),%esp
  8020e7:	5b                   	pop    %ebx
  8020e8:	5e                   	pop    %esi
  8020e9:	5d                   	pop    %ebp
  8020ea:	c3                   	ret    
		if(from_env_store)*from_env_store = 0;
  8020eb:	85 f6                	test   %esi,%esi
  8020ed:	74 06                	je     8020f5 <ipc_recv+0x75>
  8020ef:	c7 06 00 00 00 00    	movl   $0x0,(%esi)
		if(perm_store)*perm_store = 0;
  8020f5:	85 db                	test   %ebx,%ebx
  8020f7:	74 eb                	je     8020e4 <ipc_recv+0x64>
  8020f9:	c7 03 00 00 00 00    	movl   $0x0,(%ebx)
  8020ff:	eb e3                	jmp    8020e4 <ipc_recv+0x64>

00802101 <ipc_send>:
//   Use sys_yield() to be CPU-friendly.
//   If 'pg' is null, pass sys_ipc_try_send a value that it will understand
//   as meaning "no page".  (Zero is not the right value.)
void
ipc_send(envid_t to_env, uint32_t val, void *pg, int perm)
{
  802101:	f3 0f 1e fb          	endbr32 
  802105:	55                   	push   %ebp
  802106:	89 e5                	mov    %esp,%ebp
  802108:	57                   	push   %edi
  802109:	56                   	push   %esi
  80210a:	53                   	push   %ebx
  80210b:	83 ec 0c             	sub    $0xc,%esp
  80210e:	8b 7d 08             	mov    0x8(%ebp),%edi
  802111:	8b 75 0c             	mov    0xc(%ebp),%esi
  802114:	8b 5d 10             	mov    0x10(%ebp),%ebx
	// LAB 4: Your code here.
	if(!pg)pg = (void *)UTOP; // 不会进行页面共享，只会sending message。
  802117:	85 db                	test   %ebx,%ebx
  802119:	b8 00 00 c0 ee       	mov    $0xeec00000,%eax
  80211e:	0f 44 d8             	cmove  %eax,%ebx
	int error;
	// Keep trying until it succeeds.
	while((error = sys_ipc_try_send(to_env, val, pg, perm)) < 0){
  802121:	ff 75 14             	pushl  0x14(%ebp)
  802124:	53                   	push   %ebx
  802125:	56                   	push   %esi
  802126:	57                   	push   %edi
  802127:	e8 c1 ed ff ff       	call   800eed <sys_ipc_try_send>
  80212c:	83 c4 10             	add    $0x10,%esp
  80212f:	85 c0                	test   %eax,%eax
  802131:	79 1e                	jns    802151 <ipc_send+0x50>
        //如果error是没有接收者，那么就会继续尝试send
		if(error != -E_IPC_NOT_RECV){
  802133:	83 f8 f9             	cmp    $0xfffffff9,%eax
  802136:	75 07                	jne    80213f <ipc_send+0x3e>
			panic("sys_ipc_try_send:%e", error);
		}
        //但是不是一味的占用cpu，而是尝试一次就释放CPU，等待再次被调度，才会重新send，寻找receiver。
		sys_yield(); // To be CPU-friendly.
  802138:	e8 e8 eb ff ff       	call   800d25 <sys_yield>
  80213d:	eb e2                	jmp    802121 <ipc_send+0x20>
			panic("sys_ipc_try_send:%e", error);
  80213f:	50                   	push   %eax
  802140:	68 18 2b 80 00       	push   $0x802b18
  802145:	6a 3b                	push   $0x3b
  802147:	68 2c 2b 80 00       	push   $0x802b2c
  80214c:	e8 f5 e0 ff ff       	call   800246 <_panic>
	}
}
  802151:	8d 65 f4             	lea    -0xc(%ebp),%esp
  802154:	5b                   	pop    %ebx
  802155:	5e                   	pop    %esi
  802156:	5f                   	pop    %edi
  802157:	5d                   	pop    %ebp
  802158:	c3                   	ret    

00802159 <ipc_find_env>:
// Find the first environment of the given type.  We'll use this to
// find special environments.
// Returns 0 if no such environment exists.
envid_t
ipc_find_env(enum EnvType type)
{
  802159:	f3 0f 1e fb          	endbr32 
  80215d:	55                   	push   %ebp
  80215e:	89 e5                	mov    %esp,%ebp
  802160:	8b 4d 08             	mov    0x8(%ebp),%ecx
	int i;
	for (i = 0; i < NENV; i++)
  802163:	b8 00 00 00 00       	mov    $0x0,%eax
		if (envs[i].env_type == type)
  802168:	6b d0 7c             	imul   $0x7c,%eax,%edx
  80216b:	81 c2 00 00 c0 ee    	add    $0xeec00000,%edx
  802171:	8b 52 50             	mov    0x50(%edx),%edx
  802174:	39 ca                	cmp    %ecx,%edx
  802176:	74 11                	je     802189 <ipc_find_env+0x30>
	for (i = 0; i < NENV; i++)
  802178:	83 c0 01             	add    $0x1,%eax
  80217b:	3d 00 04 00 00       	cmp    $0x400,%eax
  802180:	75 e6                	jne    802168 <ipc_find_env+0xf>
			return envs[i].env_id;
	return 0;
  802182:	b8 00 00 00 00       	mov    $0x0,%eax
  802187:	eb 0b                	jmp    802194 <ipc_find_env+0x3b>
			return envs[i].env_id;
  802189:	6b c0 7c             	imul   $0x7c,%eax,%eax
  80218c:	05 00 00 c0 ee       	add    $0xeec00000,%eax
  802191:	8b 40 48             	mov    0x48(%eax),%eax
}
  802194:	5d                   	pop    %ebp
  802195:	c3                   	ret    

00802196 <pageref>:
#include <inc/lib.h>

int
pageref(void *v)
{
  802196:	f3 0f 1e fb          	endbr32 
  80219a:	55                   	push   %ebp
  80219b:	89 e5                	mov    %esp,%ebp
  80219d:	8b 45 08             	mov    0x8(%ebp),%eax
	pte_t pte;

	if (!(uvpd[PDX(v)] & PTE_P))
  8021a0:	89 c2                	mov    %eax,%edx
  8021a2:	c1 ea 16             	shr    $0x16,%edx
  8021a5:	8b 0c 95 00 d0 7b ef 	mov    -0x10843000(,%edx,4),%ecx
		return 0;
  8021ac:	ba 00 00 00 00       	mov    $0x0,%edx
	if (!(uvpd[PDX(v)] & PTE_P))
  8021b1:	f6 c1 01             	test   $0x1,%cl
  8021b4:	74 1c                	je     8021d2 <pageref+0x3c>
	pte = uvpt[PGNUM(v)];
  8021b6:	c1 e8 0c             	shr    $0xc,%eax
  8021b9:	8b 04 85 00 00 40 ef 	mov    -0x10c00000(,%eax,4),%eax
	if (!(pte & PTE_P))
  8021c0:	a8 01                	test   $0x1,%al
  8021c2:	74 0e                	je     8021d2 <pageref+0x3c>
		return 0;
	return pages[PGNUM(pte)].pp_ref;
  8021c4:	c1 e8 0c             	shr    $0xc,%eax
  8021c7:	0f b7 14 c5 04 00 00 	movzwl -0x10fffffc(,%eax,8),%edx
  8021ce:	ef 
  8021cf:	0f b7 d2             	movzwl %dx,%edx
}
  8021d2:	89 d0                	mov    %edx,%eax
  8021d4:	5d                   	pop    %ebp
  8021d5:	c3                   	ret    
  8021d6:	66 90                	xchg   %ax,%ax
  8021d8:	66 90                	xchg   %ax,%ax
  8021da:	66 90                	xchg   %ax,%ax
  8021dc:	66 90                	xchg   %ax,%ax
  8021de:	66 90                	xchg   %ax,%ax

008021e0 <__udivdi3>:
  8021e0:	f3 0f 1e fb          	endbr32 
  8021e4:	55                   	push   %ebp
  8021e5:	57                   	push   %edi
  8021e6:	56                   	push   %esi
  8021e7:	53                   	push   %ebx
  8021e8:	83 ec 1c             	sub    $0x1c,%esp
  8021eb:	8b 54 24 3c          	mov    0x3c(%esp),%edx
  8021ef:	8b 6c 24 30          	mov    0x30(%esp),%ebp
  8021f3:	8b 74 24 34          	mov    0x34(%esp),%esi
  8021f7:	8b 5c 24 38          	mov    0x38(%esp),%ebx
  8021fb:	85 d2                	test   %edx,%edx
  8021fd:	75 19                	jne    802218 <__udivdi3+0x38>
  8021ff:	39 f3                	cmp    %esi,%ebx
  802201:	76 4d                	jbe    802250 <__udivdi3+0x70>
  802203:	31 ff                	xor    %edi,%edi
  802205:	89 e8                	mov    %ebp,%eax
  802207:	89 f2                	mov    %esi,%edx
  802209:	f7 f3                	div    %ebx
  80220b:	89 fa                	mov    %edi,%edx
  80220d:	83 c4 1c             	add    $0x1c,%esp
  802210:	5b                   	pop    %ebx
  802211:	5e                   	pop    %esi
  802212:	5f                   	pop    %edi
  802213:	5d                   	pop    %ebp
  802214:	c3                   	ret    
  802215:	8d 76 00             	lea    0x0(%esi),%esi
  802218:	39 f2                	cmp    %esi,%edx
  80221a:	76 14                	jbe    802230 <__udivdi3+0x50>
  80221c:	31 ff                	xor    %edi,%edi
  80221e:	31 c0                	xor    %eax,%eax
  802220:	89 fa                	mov    %edi,%edx
  802222:	83 c4 1c             	add    $0x1c,%esp
  802225:	5b                   	pop    %ebx
  802226:	5e                   	pop    %esi
  802227:	5f                   	pop    %edi
  802228:	5d                   	pop    %ebp
  802229:	c3                   	ret    
  80222a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802230:	0f bd fa             	bsr    %edx,%edi
  802233:	83 f7 1f             	xor    $0x1f,%edi
  802236:	75 48                	jne    802280 <__udivdi3+0xa0>
  802238:	39 f2                	cmp    %esi,%edx
  80223a:	72 06                	jb     802242 <__udivdi3+0x62>
  80223c:	31 c0                	xor    %eax,%eax
  80223e:	39 eb                	cmp    %ebp,%ebx
  802240:	77 de                	ja     802220 <__udivdi3+0x40>
  802242:	b8 01 00 00 00       	mov    $0x1,%eax
  802247:	eb d7                	jmp    802220 <__udivdi3+0x40>
  802249:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802250:	89 d9                	mov    %ebx,%ecx
  802252:	85 db                	test   %ebx,%ebx
  802254:	75 0b                	jne    802261 <__udivdi3+0x81>
  802256:	b8 01 00 00 00       	mov    $0x1,%eax
  80225b:	31 d2                	xor    %edx,%edx
  80225d:	f7 f3                	div    %ebx
  80225f:	89 c1                	mov    %eax,%ecx
  802261:	31 d2                	xor    %edx,%edx
  802263:	89 f0                	mov    %esi,%eax
  802265:	f7 f1                	div    %ecx
  802267:	89 c6                	mov    %eax,%esi
  802269:	89 e8                	mov    %ebp,%eax
  80226b:	89 f7                	mov    %esi,%edi
  80226d:	f7 f1                	div    %ecx
  80226f:	89 fa                	mov    %edi,%edx
  802271:	83 c4 1c             	add    $0x1c,%esp
  802274:	5b                   	pop    %ebx
  802275:	5e                   	pop    %esi
  802276:	5f                   	pop    %edi
  802277:	5d                   	pop    %ebp
  802278:	c3                   	ret    
  802279:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802280:	89 f9                	mov    %edi,%ecx
  802282:	b8 20 00 00 00       	mov    $0x20,%eax
  802287:	29 f8                	sub    %edi,%eax
  802289:	d3 e2                	shl    %cl,%edx
  80228b:	89 54 24 08          	mov    %edx,0x8(%esp)
  80228f:	89 c1                	mov    %eax,%ecx
  802291:	89 da                	mov    %ebx,%edx
  802293:	d3 ea                	shr    %cl,%edx
  802295:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  802299:	09 d1                	or     %edx,%ecx
  80229b:	89 f2                	mov    %esi,%edx
  80229d:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8022a1:	89 f9                	mov    %edi,%ecx
  8022a3:	d3 e3                	shl    %cl,%ebx
  8022a5:	89 c1                	mov    %eax,%ecx
  8022a7:	d3 ea                	shr    %cl,%edx
  8022a9:	89 f9                	mov    %edi,%ecx
  8022ab:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  8022af:	89 eb                	mov    %ebp,%ebx
  8022b1:	d3 e6                	shl    %cl,%esi
  8022b3:	89 c1                	mov    %eax,%ecx
  8022b5:	d3 eb                	shr    %cl,%ebx
  8022b7:	09 de                	or     %ebx,%esi
  8022b9:	89 f0                	mov    %esi,%eax
  8022bb:	f7 74 24 08          	divl   0x8(%esp)
  8022bf:	89 d6                	mov    %edx,%esi
  8022c1:	89 c3                	mov    %eax,%ebx
  8022c3:	f7 64 24 0c          	mull   0xc(%esp)
  8022c7:	39 d6                	cmp    %edx,%esi
  8022c9:	72 15                	jb     8022e0 <__udivdi3+0x100>
  8022cb:	89 f9                	mov    %edi,%ecx
  8022cd:	d3 e5                	shl    %cl,%ebp
  8022cf:	39 c5                	cmp    %eax,%ebp
  8022d1:	73 04                	jae    8022d7 <__udivdi3+0xf7>
  8022d3:	39 d6                	cmp    %edx,%esi
  8022d5:	74 09                	je     8022e0 <__udivdi3+0x100>
  8022d7:	89 d8                	mov    %ebx,%eax
  8022d9:	31 ff                	xor    %edi,%edi
  8022db:	e9 40 ff ff ff       	jmp    802220 <__udivdi3+0x40>
  8022e0:	8d 43 ff             	lea    -0x1(%ebx),%eax
  8022e3:	31 ff                	xor    %edi,%edi
  8022e5:	e9 36 ff ff ff       	jmp    802220 <__udivdi3+0x40>
  8022ea:	66 90                	xchg   %ax,%ax
  8022ec:	66 90                	xchg   %ax,%ax
  8022ee:	66 90                	xchg   %ax,%ax

008022f0 <__umoddi3>:
  8022f0:	f3 0f 1e fb          	endbr32 
  8022f4:	55                   	push   %ebp
  8022f5:	57                   	push   %edi
  8022f6:	56                   	push   %esi
  8022f7:	53                   	push   %ebx
  8022f8:	83 ec 1c             	sub    $0x1c,%esp
  8022fb:	8b 44 24 3c          	mov    0x3c(%esp),%eax
  8022ff:	8b 74 24 30          	mov    0x30(%esp),%esi
  802303:	8b 5c 24 34          	mov    0x34(%esp),%ebx
  802307:	8b 7c 24 38          	mov    0x38(%esp),%edi
  80230b:	85 c0                	test   %eax,%eax
  80230d:	75 19                	jne    802328 <__umoddi3+0x38>
  80230f:	39 df                	cmp    %ebx,%edi
  802311:	76 5d                	jbe    802370 <__umoddi3+0x80>
  802313:	89 f0                	mov    %esi,%eax
  802315:	89 da                	mov    %ebx,%edx
  802317:	f7 f7                	div    %edi
  802319:	89 d0                	mov    %edx,%eax
  80231b:	31 d2                	xor    %edx,%edx
  80231d:	83 c4 1c             	add    $0x1c,%esp
  802320:	5b                   	pop    %ebx
  802321:	5e                   	pop    %esi
  802322:	5f                   	pop    %edi
  802323:	5d                   	pop    %ebp
  802324:	c3                   	ret    
  802325:	8d 76 00             	lea    0x0(%esi),%esi
  802328:	89 f2                	mov    %esi,%edx
  80232a:	39 d8                	cmp    %ebx,%eax
  80232c:	76 12                	jbe    802340 <__umoddi3+0x50>
  80232e:	89 f0                	mov    %esi,%eax
  802330:	89 da                	mov    %ebx,%edx
  802332:	83 c4 1c             	add    $0x1c,%esp
  802335:	5b                   	pop    %ebx
  802336:	5e                   	pop    %esi
  802337:	5f                   	pop    %edi
  802338:	5d                   	pop    %ebp
  802339:	c3                   	ret    
  80233a:	8d b6 00 00 00 00    	lea    0x0(%esi),%esi
  802340:	0f bd e8             	bsr    %eax,%ebp
  802343:	83 f5 1f             	xor    $0x1f,%ebp
  802346:	75 50                	jne    802398 <__umoddi3+0xa8>
  802348:	39 d8                	cmp    %ebx,%eax
  80234a:	0f 82 e0 00 00 00    	jb     802430 <__umoddi3+0x140>
  802350:	89 d9                	mov    %ebx,%ecx
  802352:	39 f7                	cmp    %esi,%edi
  802354:	0f 86 d6 00 00 00    	jbe    802430 <__umoddi3+0x140>
  80235a:	89 d0                	mov    %edx,%eax
  80235c:	89 ca                	mov    %ecx,%edx
  80235e:	83 c4 1c             	add    $0x1c,%esp
  802361:	5b                   	pop    %ebx
  802362:	5e                   	pop    %esi
  802363:	5f                   	pop    %edi
  802364:	5d                   	pop    %ebp
  802365:	c3                   	ret    
  802366:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80236d:	8d 76 00             	lea    0x0(%esi),%esi
  802370:	89 fd                	mov    %edi,%ebp
  802372:	85 ff                	test   %edi,%edi
  802374:	75 0b                	jne    802381 <__umoddi3+0x91>
  802376:	b8 01 00 00 00       	mov    $0x1,%eax
  80237b:	31 d2                	xor    %edx,%edx
  80237d:	f7 f7                	div    %edi
  80237f:	89 c5                	mov    %eax,%ebp
  802381:	89 d8                	mov    %ebx,%eax
  802383:	31 d2                	xor    %edx,%edx
  802385:	f7 f5                	div    %ebp
  802387:	89 f0                	mov    %esi,%eax
  802389:	f7 f5                	div    %ebp
  80238b:	89 d0                	mov    %edx,%eax
  80238d:	31 d2                	xor    %edx,%edx
  80238f:	eb 8c                	jmp    80231d <__umoddi3+0x2d>
  802391:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  802398:	89 e9                	mov    %ebp,%ecx
  80239a:	ba 20 00 00 00       	mov    $0x20,%edx
  80239f:	29 ea                	sub    %ebp,%edx
  8023a1:	d3 e0                	shl    %cl,%eax
  8023a3:	89 44 24 08          	mov    %eax,0x8(%esp)
  8023a7:	89 d1                	mov    %edx,%ecx
  8023a9:	89 f8                	mov    %edi,%eax
  8023ab:	d3 e8                	shr    %cl,%eax
  8023ad:	8b 4c 24 08          	mov    0x8(%esp),%ecx
  8023b1:	89 54 24 04          	mov    %edx,0x4(%esp)
  8023b5:	8b 54 24 04          	mov    0x4(%esp),%edx
  8023b9:	09 c1                	or     %eax,%ecx
  8023bb:	89 d8                	mov    %ebx,%eax
  8023bd:	89 4c 24 08          	mov    %ecx,0x8(%esp)
  8023c1:	89 e9                	mov    %ebp,%ecx
  8023c3:	d3 e7                	shl    %cl,%edi
  8023c5:	89 d1                	mov    %edx,%ecx
  8023c7:	d3 e8                	shr    %cl,%eax
  8023c9:	89 e9                	mov    %ebp,%ecx
  8023cb:	89 7c 24 0c          	mov    %edi,0xc(%esp)
  8023cf:	d3 e3                	shl    %cl,%ebx
  8023d1:	89 c7                	mov    %eax,%edi
  8023d3:	89 d1                	mov    %edx,%ecx
  8023d5:	89 f0                	mov    %esi,%eax
  8023d7:	d3 e8                	shr    %cl,%eax
  8023d9:	89 e9                	mov    %ebp,%ecx
  8023db:	89 fa                	mov    %edi,%edx
  8023dd:	d3 e6                	shl    %cl,%esi
  8023df:	09 d8                	or     %ebx,%eax
  8023e1:	f7 74 24 08          	divl   0x8(%esp)
  8023e5:	89 d1                	mov    %edx,%ecx
  8023e7:	89 f3                	mov    %esi,%ebx
  8023e9:	f7 64 24 0c          	mull   0xc(%esp)
  8023ed:	89 c6                	mov    %eax,%esi
  8023ef:	89 d7                	mov    %edx,%edi
  8023f1:	39 d1                	cmp    %edx,%ecx
  8023f3:	72 06                	jb     8023fb <__umoddi3+0x10b>
  8023f5:	75 10                	jne    802407 <__umoddi3+0x117>
  8023f7:	39 c3                	cmp    %eax,%ebx
  8023f9:	73 0c                	jae    802407 <__umoddi3+0x117>
  8023fb:	2b 44 24 0c          	sub    0xc(%esp),%eax
  8023ff:	1b 54 24 08          	sbb    0x8(%esp),%edx
  802403:	89 d7                	mov    %edx,%edi
  802405:	89 c6                	mov    %eax,%esi
  802407:	89 ca                	mov    %ecx,%edx
  802409:	0f b6 4c 24 04       	movzbl 0x4(%esp),%ecx
  80240e:	29 f3                	sub    %esi,%ebx
  802410:	19 fa                	sbb    %edi,%edx
  802412:	89 d0                	mov    %edx,%eax
  802414:	d3 e0                	shl    %cl,%eax
  802416:	89 e9                	mov    %ebp,%ecx
  802418:	d3 eb                	shr    %cl,%ebx
  80241a:	d3 ea                	shr    %cl,%edx
  80241c:	09 d8                	or     %ebx,%eax
  80241e:	83 c4 1c             	add    $0x1c,%esp
  802421:	5b                   	pop    %ebx
  802422:	5e                   	pop    %esi
  802423:	5f                   	pop    %edi
  802424:	5d                   	pop    %ebp
  802425:	c3                   	ret    
  802426:	8d b4 26 00 00 00 00 	lea    0x0(%esi,%eiz,1),%esi
  80242d:	8d 76 00             	lea    0x0(%esi),%esi
  802430:	29 fe                	sub    %edi,%esi
  802432:	19 c3                	sbb    %eax,%ebx
  802434:	89 f2                	mov    %esi,%edx
  802436:	89 d9                	mov    %ebx,%ecx
  802438:	e9 1d ff ff ff       	jmp    80235a <__umoddi3+0x6a>
